Skip to content

Commit

Permalink
Make channels_redis group expiry configuration configurable through a…
Browse files Browse the repository at this point in the history
…n environmental variable.
  • Loading branch information
sebastian-aranda committed Nov 4, 2024
1 parent d848abd commit fb3e998
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions manager/manager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@
"love-nginx",
SERVER_URL,
]
CSRF_TRUSTED_ORIGINS = [
f"https://{SERVER_URL}",
f"http://{SERVER_URL}"
]
CSRF_TRUSTED_ORIGINS = [f"https://{SERVER_URL}", f"http://{SERVER_URL}"]
"""List of Django allowed hosts (`list` of `string`)"""

# Application definition
Expand Down Expand Up @@ -254,6 +251,7 @@
REDIS_PASS = os.environ.get("REDIS_PASS", False)
REDIS_CONFIG_EXPIRY = int(os.environ.get("REDIS_CONFIG_EXPIRY", 60))
REDIS_CONFIG_CAPACITY = int(os.environ.get("REDIS_CONFIG_CAPACITY", 100))
REDIS_CONFIG_GROUP_EXPIRY = int(os.environ.get("REDIS_CONFIG_GROUP_EXPIRY", 86400))
if REDIS_HOST and not TESTING:
CHANNEL_LAYERS = {
"default": {
Expand All @@ -270,11 +268,7 @@
],
"expiry": REDIS_CONFIG_EXPIRY,
"capacity": REDIS_CONFIG_CAPACITY,
# Set group_expiry to 1 year to avoid group messages being
# dropped when the group is not used frequently.
# TODO: Solve this particular issue in a better way.
# See: DM-41728
"group_expiry": 31536000,
"group_expiry": REDIS_CONFIG_GROUP_EXPIRY,
},
},
}
Expand Down

0 comments on commit fb3e998

Please sign in to comment.