def cleanupNonces(self):
"""Remove expired nonces from the store.
Discards any nonce from storage that is old enough that its
timestamp would not pass L{useNonce}.
This method is not called in the normal operation of the
library. It provides a way for store admins to keep
their storage from filling up with expired data.
@return: the number of nonces expired.
@returntype: int
"""
try:
mist_nonces = MistNonce.objects()
except me.DoesNotExist:
mist_nonces = []
counter = 0
for nonce in mist_nonces:
if nonce.is_old():
nonce.delete()
counter += 1
return counter
评论列表
文章目录