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

Commit

Permalink
Only enable this functionality for Redis-based deployments
Browse files Browse the repository at this point in the history
TCP replication's 'direct to master' style does not interact well, and besides,

TCP replication is obsolete.
  • Loading branch information
reivilibre committed Mar 25, 2022
1 parent cf050d8 commit 352f52c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changelog.d/12251.feature
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Move `update_client_ip` background job from the main process to the background worker.
Offload the `update_client_ip` background job from the main process to the background worker, when using Redis-based replication.
8 changes: 7 additions & 1 deletion synapse/storage/databases/main/client_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,13 @@ def __init__(
):
super().__init__(database, db_conn, hs)

self._update_on_this_worker = hs.config.worker.run_background_tasks
if hs.config.redis.redis_enabled:
# If we're using Redis, we can shift this update process off to
# the background worker
self._update_on_this_worker = hs.config.worker.run_background_tasks
else:
# If we're NOT using Redis, this must be handled by the master
self._update_on_this_worker = hs.get_instance_name() == "master"

self.user_ips_max_age = hs.config.server.user_ips_max_age

Expand Down
8 changes: 7 additions & 1 deletion synapse/storage/databases/main/monthly_active_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ def __init__(
self._clock = hs.get_clock()
self.hs = hs

self._update_on_this_worker = hs.config.worker.run_background_tasks
if hs.config.redis.redis_enabled:
# If we're using Redis, we can shift this update process off to
# the background worker
self._update_on_this_worker = hs.config.worker.run_background_tasks
else:
# If we're NOT using Redis, this must be handled by the master
self._update_on_this_worker = hs.get_instance_name() == "master"

self._limit_usage_by_mau = hs.config.server.limit_usage_by_mau
self._max_mau_value = hs.config.server.max_mau_value
Expand Down

0 comments on commit 352f52c

Please sign in to comment.