Skip to content

Commit

Permalink
boxine#91 update parent_task.update_dt on subtask signal
Browse files Browse the repository at this point in the history
cf boxine#91: update update_dt of the parent task when a signal is received from a sub-task
  • Loading branch information
Skrattoune authored Mar 25, 2022
1 parent c2e5e21 commit a8de00e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions huey_monitor/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import uuid
from functools import lru_cache

from django.utils import timezone
from django.db import transaction
from django.db.models import Sum
from huey.contrib.djhuey import on_startup, signal
Expand Down Expand Up @@ -43,6 +44,10 @@ def update_task_instance(instance, last_signal, task_finished):
update_fields.append('progress_count')

instance.save(update_fields=update_fields)

if instance.parent_task:
instance.parent_task.update_dt = timezone.now()
instance.parent_task.save(update_fields='update_dt')


@signal()
Expand Down

0 comments on commit a8de00e

Please sign in to comment.