我想为请求设置一个时间限制,这样,如果队列关闭,客户机就不必等待很长时间来获取连接错误。目前,当我向已关闭的队列发出请求时,在得到异常之前,应用程序会挂起很多时间。你知道吗
我试着在客户机请求中设置time\u limit、soft\u time\u limit、timeout和soft\u timeout,但都没有成功。你知道吗
如何设置请求在失败之前等待响应的超时?你知道吗
这是我用来调用的代码。你知道吗
task = clusterWorking.apply_async(queue=q, soft_time_limit=2, time_limit=5)
task = clusterWorking.apply_async(queue=q, timeout=1, soft_timeout=1)
这是服务器代码。你知道吗
@task(name='manager.pingdaemon.clusterWorking')
def clusterWorking():
return "up"
可以使用get(超时) http://celery.readthedocs.org/en/latest/reference/celery.result.html?highlight=get#celery.result.ResultSet.get
相关问题 更多 >
编程相关推荐