diff --git a/django_code/apps/telegram_communication/utils.py b/django_code/apps/telegram_communication/utils.py index ac99729..8fbeb07 100644 --- a/django_code/apps/telegram_communication/utils.py +++ b/django_code/apps/telegram_communication/utils.py @@ -67,10 +67,10 @@ class telegramUtils(): return send_result def clear_expired_messages(self): - yesterday=datetime.now()+timedelta(days=-1) + today = datetime.now() #filter all the messages that expired yesterday or before expired_messages_list = [] - expired_messages = TelegramData.objects.filter(expiration_date__lte=yesterday) + expired_messages = TelegramData.objects.filter(expiration_date__lte=today) #leave if the list is empty if len(expired_messages) == 0: