Skip to content

Commit

Permalink
include additional redis keyword arguments (#102)
Browse files Browse the repository at this point in the history
Co-authored-by: Mario Behling <[email protected]>
  • Loading branch information
untari and mariobehling authored Jun 18, 2024
1 parent 3e6a491 commit 7e47034
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/venueless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from django.utils.crypto import get_random_string
from kombu import Queue
from redis.asyncio.retry import Retry
from redis.backoff import ExponentialBackoff

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATA_DIR = os.environ.get("VENUELESS_DATA_DIR", os.path.join(BASE_DIR, "data"))
Expand Down Expand Up @@ -111,9 +113,14 @@
}
}

redis_connection_kwargs = {
"retry": Retry(ExponentialBackoff(), 3),
"health_check_interval": 120,
}

if os.getenv("VENUELESS_REDIS_URLS", config.get("redis", "urls", fallback="")):
REDIS_HOSTS = [
{"address": u}
{"address": u, **redis_connection_kwargs}
for u in os.getenv(
"VENUELESS_REDIS_URLS", config.get("redis", "urls", fallback="")
).split(",")
Expand Down Expand Up @@ -141,7 +148,7 @@
config.get("redis", "db", fallback="0"),
)
)
REDIS_HOSTS = [{"address": redis_url}]
REDIS_HOSTS = [{"address": redis_url, **redis_connection_kwargs}]


REDIS_USE_PUBSUB = os.getenv(
Expand Down

0 comments on commit 7e47034

Please sign in to comment.