allegro / tipboard

Tipboard - in-house, tasty, local dashboarding system
http://allegro.github.io/tipboard/
Other
1.11k stars 159 forks source link

Setup timeout to redis connexion #59

Open LucCADORET opened 5 years ago

LucCADORET commented 5 years ago

Hi, I figured there was no timeout to the redis connexion, and both need to up when tipboard starts, otherwise it'll the crash. Since I am trying to dockerize everything and put that in some swarm, I now have redis and tipboard that start separately in 2 different containers, that start in an unpredictable order, meaning that tipboard won't work if it boots before redis. Would it be possible to configure a timeout for the redis connexion ? That way tipboard could way for a specific amout of time before giving up on booting.

Nice tool btw, props to the team.

vi4m commented 5 years ago

Yes, it's possible right away.

In settings.py file, find line:

REDIS_SYNC = dict(
    host=REDIS_HOST,
    port=REDIS_PORT,
    password=REDIS_PASSWORD,
    db=REDIS_DB,
)

modify it to something like this:

REDIS_SYNC = dict(
    host=REDIS_HOST,
    port=REDIS_PORT,
    password=REDIS_PASSWORD,
    db=REDIS_DB,
    socket_timeout=10,
    socket_connect_timeout=1000
)

You can use any of options from here:

https://redis-py.readthedocs.io/en/latest/#contents
the-maux commented 4 years ago

Thanks to Django, this is resolved in my pr #70

Django can start without redis to be up, only when a client connection is started that become to be a requirements, even if redis is slow to start, django will start automaticaly the connection again after a failed.