-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve redis worker stability #77
base: master
Are you sure you want to change the base?
Conversation
2. use default multiprocessing process start method to use fork mode on linux;
return pickle.loads(message["data"]) | ||
except RedisError as e: | ||
logger.warning('recv_response: redis error occurs in get_message, {}', str(e)) | ||
self._setup() # 重新订阅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be an issue here. self._setup()
fails when redis server is stopped, but when redis server restarts, this self._setup()
usually will not get executed because the above try:
entry now returns with no error.
self._setup() # 重新订阅 | |
while True: | |
try: | |
self._redis.ping() | |
self._setup() # 重新订阅 | |
break | |
except RedisError as e: | |
time.sleep(0.2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find that completely removal of the self._setup()
part in the error handling step also works. It looks like redis-py recovers the connection and the previously subscribed channel after the failure.
If the _setup()
is executed and erred during the redis-server's downtime, then redis-py cannot recover previous subscription anymore.
fix redis worker hang when redis connection is lost or redis server is restarted. When redis server is restarted, the collect thread in original service streamer will exit;
fix redis subscribe channel lost when redis subscribe connection receive no message for a long time. Add health check for get_messsage api.
remove the requirement that redis server subscribes all channels.