在我使用pynsq的时候遇到这样的问题,需要处理长时间的任务,nsq报错提示:
ERROR:nsq.client:[127.0.0.1:4150:hello:channel]
ERROR: ConnectionClosedError('Stream is closed',)
WARNING:nsq.reader:[127.0.0.1:4150:hello:channel] connection closed
这是我的测试代码:
def process_message(message):
print(message)
time.sleep(100)
message.touch()
return True
r_check = nsq.Reader(
message_handler=process_message,
nsqd_tcp_addresses=['127.0.0.1:4150'],
topic='hello', channel='channel',
lookupd_poll_interval=15,
lookupd_connect_timeout=100000,
lookupd_request_timeout=100000,
max_tries=10
)
nsq.run() # tornado.ioloop.IOLoop.instance().start()