Commit f1d9a5c6 by David Ormsbee

Only close cache on post_fork() if cache supports it.

In particular LocMemCache doesn't have this option.
parent 08a45956
...@@ -17,6 +17,7 @@ def post_fork(server, worker): ...@@ -17,6 +17,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ ANALYTICS_API_GUNICORN_EXTRA_CONF }} {{ ANALYTICS_API_GUNICORN_EXTRA_CONF }}
...@@ -17,6 +17,7 @@ def post_fork(server, worker): ...@@ -17,6 +17,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ '{{' }} {{ role_name|upper }}_GUNICORN_EXTRA_CONF }} {{ '{{' }} {{ role_name|upper }}_GUNICORN_EXTRA_CONF }}
...@@ -17,6 +17,7 @@ def post_fork(server, worker): ...@@ -17,6 +17,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ ECOMMERCE_GUNICORN_EXTRA_CONF }} {{ ECOMMERCE_GUNICORN_EXTRA_CONF }}
...@@ -24,6 +24,7 @@ def post_fork(server, worker): ...@@ -24,6 +24,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ EDX_NOTES_API_WORKERS_EXTRA_CONF }} {{ EDX_NOTES_API_WORKERS_EXTRA_CONF }}
...@@ -28,6 +28,7 @@ def post_fork(server, worker): ...@@ -28,6 +28,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ EDXAPP_CMS_GUNICORN_EXTRA_CONF }} {{ EDXAPP_CMS_GUNICORN_EXTRA_CONF }}
...@@ -28,6 +28,7 @@ def post_fork(server, worker): ...@@ -28,6 +28,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ EDXAPP_LMS_GUNICORN_EXTRA_CONF }} {{ EDXAPP_LMS_GUNICORN_EXTRA_CONF }}
...@@ -19,6 +19,7 @@ def post_fork(server, worker): ...@@ -19,6 +19,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ GITRELOAD_GUNICORN_EXTRA_CONF }} {{ GITRELOAD_GUNICORN_EXTRA_CONF }}
...@@ -18,6 +18,7 @@ def post_fork(server, worker): ...@@ -18,6 +18,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ ORA_GUNICORN_EXTRA_CONF }} {{ ORA_GUNICORN_EXTRA_CONF }}
...@@ -17,6 +17,7 @@ def post_fork(server, worker): ...@@ -17,6 +17,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ PROGRAMS_GUNICORN_EXTRA_CONF }} {{ PROGRAMS_GUNICORN_EXTRA_CONF }}
...@@ -24,6 +24,7 @@ def post_fork(server, worker): ...@@ -24,6 +24,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ XQUEUE_GUNICORN_WORKERS_EXTRA_CONF }} {{ XQUEUE_GUNICORN_WORKERS_EXTRA_CONF }}
...@@ -18,6 +18,7 @@ def post_fork(server, worker): ...@@ -18,6 +18,7 @@ def post_fork(server, worker):
another worker. another worker.
""" """
from django.core.cache import cache from django.core.cache import cache
cache.close() if hasattr(cache, 'close'):
cache.close()
{{ XSERVER_GUNICORN_EXTRA_CONF }} {{ XSERVER_GUNICORN_EXTRA_CONF }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment