Description
When I was deploying pubsub layer using AWS Redis ElasticCache using default paramters, I noticed that occasionally my webservers will report
Connection closed by server.
during group_send
PUBLISH
from redis-py client returning b''
from a stale connection.
Adding health_check_interval and tcp keep alive seems to fix the problem
"hosts": [
dict(
host=...,
port=...,
socket_keepalive=True,
health_check_interval=15,
retry_on_timeout=True,
)
],
I am not sure why this issue is not present with the default implementation. (I wonder if it is because the "polling" from default impl keeps the connections in the pool alive). For PubSub, I think it makes sense since the connection could get stale if there are no activity for a while?
Anyhow, wondering if it is worth adding a section to the README regarding these config values for pubsub.
cc @acu192 as you have a lot of experience running this in production.