Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Move the execution of the retention purge_jobs to the main worker #13632

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13632.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the running of MSC1763 retention purge_jobs in multi-worker setups by only running them on the main worker. Contributed by Brad @ Beeper.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is really "when you have a background worker configured"?

bradtgmurray marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 2 additions & 4 deletions synapse/handlers/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,9 @@ def __init__(self, hs: "HomeServer"):
self._retention_allowed_lifetime_max = (
hs.config.retention.retention_allowed_lifetime_max
)
self._is_master = hs.config.worker.worker_app is None

if (
hs.config.worker.run_background_tasks
and hs.config.retention.retention_enabled
):
if hs.config.retention.retention_enabled and self._is_master:
# Run the purge jobs described in the configuration file.
for job in hs.config.retention.retention_purge_jobs:
logger.info("Setting up purge job with config: %s", job)
Expand Down