Only expire KeyConfirmationQueue items that haven't been confirmed
This commit is contained in:
parent
abd3f923fb
commit
c92b9aed80
1 changed files with 8 additions and 1 deletions
|
@ -175,7 +175,14 @@ class KeyConfirmationQueue:
|
||||||
|
|
||||||
def delete_expired_queue_items(self, older_than: datetime):
|
def delete_expired_queue_items(self, older_than: datetime):
|
||||||
"""Remove keys that have been in queue before `older_than`."""
|
"""Remove keys that have been in queue before `older_than`."""
|
||||||
delq = delete(self._keys).where(self._keys.c.time < older_than)
|
delq = delete(self._keys) \
|
||||||
|
.where(
|
||||||
|
and_(
|
||||||
|
self._keys.c.time < older_than,
|
||||||
|
# We only want to delete keys that haven't been confirmed.
|
||||||
|
self._keys.c.confirm != db.CO_CONFIRMED
|
||||||
|
)
|
||||||
|
)
|
||||||
LOG.debug('Deleting queue items older than %s: %s', repr(older_than), delq)
|
LOG.debug('Deleting queue items older than %s: %s', repr(older_than), delq)
|
||||||
|
|
||||||
with self._engine.connect() as conn:
|
with self._engine.connect() as conn:
|
||||||
|
|
Loading…
Reference in a new issue