core(minor): fix timezone warning when cleaning nonces

This commit is contained in:
Langhammer, Jens 2019-10-11 14:23:59 +02:00
parent 78c74cd469
commit f9babe7089
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
"""passbook core tasks""" """passbook core tasks"""
from datetime import datetime from django.utils.timezone import now
from structlog import get_logger from structlog import get_logger
@ -11,5 +11,5 @@ LOGGER = get_logger()
@CELERY_APP.task() @CELERY_APP.task()
def clean_nonces(): def clean_nonces():
"""Remove expired nonces""" """Remove expired nonces"""
amount, _ = Nonce.objects.filter(expires__lt=datetime.now(), expiring=True).delete() amount, _ = Nonce.objects.filter(expires__lt=now(), expiring=True).delete()
LOGGER.debug("Deleted expired nonces", amount=amount) LOGGER.debug("Deleted expired nonces", amount=amount)