fixed ticket_store cleanup times

This commit is contained in:
Adolfo Gómez García 2019-12-23 13:20:34 +01:00
parent c8839ed2a5
commit 8e76c1d733

View File

@ -157,7 +157,7 @@ class TicketStore(UUIDModel):
from datetime import timedelta from datetime import timedelta
now = getSqlDatetime() now = getSqlDatetime()
for v in TicketStore.objects.all(): for v in TicketStore.objects.all():
if now > v.stamp + timedelta(seconds=v.validity): if now > v.stamp + timedelta(seconds=v.validity+600): # Delete only really old tickets. Avoid "revalidate" issues
v.delete() v.delete()
cleanSince = now - datetime.timedelta(seconds=TicketStore.MAX_VALIDITY) cleanSince = now - datetime.timedelta(seconds=TicketStore.MAX_VALIDITY)
TicketStore.objects.filter(stamp__lt=cleanSince).delete() TicketStore.objects.filter(stamp__lt=cleanSince).delete()