Skip to content
Snippets Groups Projects
Commit 4ef59600 authored by Art's avatar Art :lizard:
Browse files

Improve the CONN_MAX_AGE check

parent 819b7967
Branches
No related tags found
No related merge requests found
......@@ -39,9 +39,9 @@ def close_db_connections():
@requires_django
def check_worker_db_settings():
t = int(django_conf.settings.CONN_MAX_AGE)
if not t or t > 20 * 60:
raise ValueError("When using django, CONN_MAX_AGE must be set to a sane value. The current value: {t} seconds.".format(t=t))
conn_age_acceptable = range(10, 20 * 60) # in seconds
if getattr(django_conf.settings, "CONN_MAX_AGE", 0) not in conn_age_acceptable:
raise ValueError("When using django, CONN_MAX_AGE must be set to a reasonable value. Accepted: {0}".format(conn_age_acceptable))
@requires_django
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment