Allow setting the recursion limit with RECURSION_LIMIT (fixes #1911)

This commit is contained in:
Mark Striemer 2016-03-15 15:22:16 +01:00
Родитель a888361aa1
Коммит 0d1edc19f2
3 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -20,6 +20,7 @@ worker: &worker
- OLYMPIA_SITE_URL - OLYMPIA_SITE_URL
- PYTHONDONTWRITEBYTECODE=1 - PYTHONDONTWRITEBYTECODE=1
- PYTHONUNBUFFERED=1 - PYTHONUNBUFFERED=1
- RECURSION_LIMIT=10000
- REDIS_LOCATION=redis://redis:6379/0?socket_timeout=0.5 - REDIS_LOCATION=redis://redis:6379/0?socket_timeout=0.5
- TERM=xterm-256color - TERM=xterm-256color

Просмотреть файл

@ -8,6 +8,8 @@ import os
from olympia.lib.settings_base import * # noqa from olympia.lib.settings_base import * # noqa
WSGI_APPLICATION = 'olympia.wsgi.application'
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
DEBUG_PROPAGATE_EXCEPTIONS = False DEBUG_PROPAGATE_EXCEPTIONS = False

Просмотреть файл

@ -1,5 +1,6 @@
import os import os
import logging import logging
import sys
from datetime import datetime from datetime import datetime
log = logging.getLogger('z.startup') log = logging.getLogger('z.startup')
@ -7,6 +8,16 @@ log = logging.getLogger('z.startup')
# Remember when mod_wsgi loaded this file so we can track it in nagios. # Remember when mod_wsgi loaded this file so we can track it in nagios.
wsgi_loaded = datetime.now() wsgi_loaded = datetime.now()
if 'RECURSION_LIMIT' in os.environ:
try:
limit = int(os.environ['RECURSION_LIMIT'])
except TypeError:
log.warning('Unable to parse RECURSION_LIMIT "{}"'.format(
os.environ['RECURSION_LIMIT']))
else:
sys.setrecursionlimit(limit)
log.info('Set RECURSION_LIMIT to {}'.format(limit))
# Tell celery that we're using Django. # Tell celery that we're using Django.
os.environ['CELERY_LOADER'] = 'django' os.environ['CELERY_LOADER'] = 'django'