Skip to content

Commit

Permalink
Use higher celery/redis visibility timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Nov 23, 2021
1 parent db33417 commit d4a1fb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Bugfixes
^^^^^^^^

- Fix editing service API calls using the service token (:pr:`5170`)
- Fix excessive retries for Celery tasks with a retry wait time longer
than 1 hour (:pr:`5172`)


Version 3.0.3
Expand Down
4 changes: 4 additions & 0 deletions indico/core/celery/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def init_app(self, app):
if not config.CELERY_BROKER and not app.config['TESTING']:
raise ValueError('Celery broker URL is not set')
self.conf['broker_url'] = config.CELERY_BROKER
if config.CELERY_BROKER and config.CELERY_BROKER.startswith('redis://'):
# default timeout is 1h, so retries >1h would result in task duplication
# https://docs.celeryproject.org/en/master/getting-started/backends-and-brokers/redis.html#visibility-timeout
self.conf['broker_transport_options'] = {'visibility_timeout': 86400*2}
self.conf['result_backend'] = config.CELERY_RESULT_BACKEND or config.CELERY_BROKER
self.conf['beat_scheduler'] = IndicoPersistentScheduler
self.conf['beat_schedule_filename'] = os.path.join(config.TEMP_DIR, 'celerybeat-schedule')
Expand Down

0 comments on commit d4a1fb5

Please sign in to comment.