https://dxian.github.io/2016/07/21/python-redis-subscribe-tcp-keepalive/
pool = redis.ConnectionPool(host=REDIS_HOST,
port=REDIS_PORT,
password=REDIS_PW,
max_connections=1,
decode_responses=True,
retry_on_timeout=True,
socket_timeout=10,
socket_connect_timeout=9,
socket_keepalive=True,
socket_keepalive_options={
socket.TCP_KEEPIDLE: 120,
socket.TCP_KEEPCNT: 2,
socket.TCP_KEEPINTVL: 30
},
health_check_interval=30,
db=REDIS_DB)
db_redis = redis.Redis(connection_pool=pool, retry_on_error=True)