Skip to content

Commit

Permalink
Fix DoesNotExist on workerstate. Fix jazzband#55
Browse files Browse the repository at this point in the history
  • Loading branch information
agutierrezrodriguez committed Jan 25, 2018
1 parent 6ec1350 commit 55e920a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django_celery_monitor/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from celery.events.state import Task
from celery.utils.time import maybe_timedelta
from django.db import models, router, transaction
from django.utils import timezone

from .utils import Now

Expand Down Expand Up @@ -47,7 +48,7 @@ class WorkerStateQuerySet(ExtendedQuerySet):
def update_heartbeat(self, hostname, heartbeat, update_freq):
with transaction.atomic():
# check if there was an update in the last n seconds?
interval = Now() - timedelta(seconds=update_freq)
interval = timezone.now() - timedelta(seconds=update_freq)
recent_worker_updates = self.filter(
hostname=hostname,
last_update__gte=interval,
Expand Down

0 comments on commit 55e920a

Please sign in to comment.