1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

ammend redis conn check to acccount for sentinel

This commit is contained in:
Dan Starner
2020-02-14 09:39:01 -05:00
parent 0a8d39cfe4
commit 03a7f6bbda

View File

@ -13,6 +13,16 @@ class ExtrasConfig(AppConfig):
# Check that we can connect to the configured Redis database.
try:
if settings.WEBHOOKS_REDIS_USING_SENTINEL:
sentinel = redis.sentinel.Sentinel(
settings.WEBHOOKS_REDIS_SENTINELS,
socket_timeout=settings.WEBHOOKS_REDIS_DEFAULT_TIMEOUT
)
rs = sentinel.master_for(
settings.WEBHOOKS_REDIS_SENTINEL_SERVICE,
socket_timeout=settings.WEBHOOKS_REDIS_DEFAULT_TIMEOUT
)
else:
rs = redis.Redis(
host=settings.WEBHOOKS_REDIS_HOST,
port=settings.WEBHOOKS_REDIS_PORT,