Skip to content

Commit

Permalink
Merge pull request #1287 from Amsterdam/128091/fix-task-timer
Browse files Browse the repository at this point in the history
128091/fix task timer
  • Loading branch information
remyvdwereld authored Nov 28, 2024
2 parents 5a69628 + 6cefa2b commit 3ea1261
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/apps/workflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ def has_a_timer_event_fired(self):
event_definition = task.task_spec.event_definition
has_fired = event_definition.has_fired(task)
if has_fired:
logger.info(
logger.warning(
f"TimerEventDefinition for task '{task.task_spec.name}' has expired. Workflow with id '{self.id}', needs an update"
)
return True
Expand Down
3 changes: 3 additions & 0 deletions app/apps/workflow/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def task_update_workflows(self):
workflow_instances = CaseWorkflow.objects.filter(completed=False)
for workflow in workflow_instances:
if workflow.has_a_timer_event_fired():
logger.warning(
f"task_update_workflows: workflow with id '{workflow.id}', has a timer event fired"
)
task_update_workflow.delay(workflow.id)
return f"task_update_workflows complete: count '{workflow_instances.count()}'"

Expand Down
4 changes: 2 additions & 2 deletions app/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,22 +514,22 @@ def get_redis_url():
}

CELERY_TASK_TRACK_STARTED = True
CELERY_TASK_TIME_LIMIT = 30 * 60
CELERY_BROKER_URL = get_redis_url()
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
BROKER_CONNECTION_MAX_RETRIES = None
BROKER_CONNECTION_TIMEOUT = 120
BROKER_URL = CELERY_BROKER_URL
CELERY_TASK_TRACK_STARTED = True
CELERY_RESULT_BACKEND = "django-db"
CELERY_TASK_TIME_LIMIT = 30 * 60
CELERY_TASK_TIME_LIMIT = 5400 # 1,5 hours
CELERY_BEAT_SCHEDULE = {
"queue_every_five_mins": {
"task": "apps.health.tasks.query_every_five_mins",
"schedule": crontab(minute=5),
},
}


CELERY_BROKER_TRANSPORT_OPTIONS = {
"socket_keepalive": True,
"socket_keepalive_options": {
Expand Down

0 comments on commit 3ea1261

Please sign in to comment.