Skip to content

Commit

Permalink
Merge pull request #217 from observatorycontrolsystem/fix/timezone-aw…
Browse files Browse the repository at this point in the history
…are-consistency

Maintain consistent use of timezone-aware datetimes
  • Loading branch information
jnation3406 committed Sep 10, 2021
2 parents 9dc37ed + 23f994b commit 900a408
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions observation_portal/observations/tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dramatiq
import logging
from datetime import datetime, timedelta
from datetime import timedelta
from django.utils import timezone

from observation_portal.observations.models import Observation

Expand All @@ -9,6 +10,6 @@

@dramatiq.actor()
def delete_old_observations():
cutoff = datetime.utcnow() - timedelta(days=14)
cutoff = timezone.now() - timedelta(days=14)
logger.info(f'Deleting CANCELED observations before cutoff date {cutoff}')
Observation.delete_old_observations(cutoff)

0 comments on commit 900a408

Please sign in to comment.