Skip to content

Commit

Permalink
set CONN_MAX_AGE to 0 and revert multiple DB routers for celery
Browse files Browse the repository at this point in the history
  • Loading branch information
rstorey committed Mar 27, 2019
1 parent 9528e2b commit 52347e3
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 33 deletions.
16 changes: 0 additions & 16 deletions concordia/db_routers.py

This file was deleted.

1 change: 0 additions & 1 deletion concordia/settings_dev.py
Expand Up @@ -14,7 +14,6 @@
DEBUG = True

DATABASES["default"]["PORT"] = "54323"
DATABASES["celery"]["PORT"] = "54323"

ALLOWED_HOSTS = ["127.0.0.1", "0.0.0.0", "*"]

Expand Down
1 change: 0 additions & 1 deletion concordia/settings_ecs.py
Expand Up @@ -26,7 +26,6 @@
postgres_secret = json.loads(postgres_secret_json)

DATABASES["default"].update({"PASSWORD": postgres_secret["password"]})
DATABASES["celery"].update({"PASSWORD": postgres_secret["password"]})

smtp_secret_json = get_secret("concordia/SMTP")
smtp_secret = json.loads(smtp_secret_json)
Expand Down
17 changes: 3 additions & 14 deletions concordia/settings_template.py
Expand Up @@ -53,23 +53,12 @@
"PASSWORD": os.getenv("POSTGRESQL_PW"),
"HOST": os.getenv("POSTGRESQL_HOST", "localhost"),
"PORT": os.getenv("POSTGRESQL_PORT", "5432"),
"CONN_MAX_AGE": 15 * 60, # Keep database connections open for 15 minutes,
},
"celery": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "concordia",
"USER": "concordia",
"PASSWORD": os.getenv("POSTGRESQL_PW"),
"HOST": os.getenv("POSTGRESQL_HOST", "localhost"),
"PORT": os.getenv("POSTGRESQL_PORT", "5432"),
# see https://github.com/celery/celery/issues/4878 re: conn_max_age
# Change this back to 15 minutes (15*60) once celery regression
# is fixed see https://github.com/celery/celery/issues/4878
"CONN_MAX_AGE": 0,
},
}
}

DATABASE_ROUTERS = ["concordia.db_routers.AppRouter"]


INSTALLED_APPS = [
"concordia.apps.ConcordiaAdminConfig", # Replaces 'django.contrib.admin'
"django.contrib.auth",
Expand Down
1 change: 0 additions & 1 deletion concordia/settings_test.py
Expand Up @@ -12,7 +12,6 @@
DEBUG = False

DATABASES["default"].update({"PASSWORD": "", "USER": "postgres"})
DATABASES["celery"].update({"PASSWORD": "", "USER": "postgres"})

DEFAULT_TO_EMAIL = "rstorey@loc.gov"

Expand Down

0 comments on commit 52347e3

Please sign in to comment.