aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/tasks')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py b/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py
index 7f8a5f2..dfe7c78 100644
--- a/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py
+++ b/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py
@@ -57,6 +57,13 @@ async def cleanup_loop(get_session):
stale = await purge_stale_pending_users(db)
if stale:
log.info("Purged %d stale pending users", stale)
+ # One row per recipient the hub has written to, and the
+ # window is a day: without this the table grows for the
+ # life of the instance and nothing ever reads the old rows.
+ from meshbay_hub import mail
+ quota = await mail.purge_expired_quota(db)
+ if quota:
+ log.info("Purged %d expired mail counters", quota)
except asyncio.CancelledError:
raise
except Exception as e: