https://dxian.github.io/2016/07/21/python-redis-subscribe-tcp-keepalive/
https://github.com/opennumber/opennumber/blob/bab590c29ab227bbcf1c301cf454c0e6681a64cc/src/context.py
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)