mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-09-07 03:11:57 +00:00
Prevent presence background jobs from running when presence is disabled (#9530)
Prevent presence background jobs from running when presence is disabled Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
parent
aee10768d8
commit
0279e0e086
1
changelog.d/9530.bugfix
Normal file
1
changelog.d/9530.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Prevent presence background jobs from running when presence is disabled.
|
@ -274,22 +274,25 @@ class PresenceHandler(BasePresenceHandler):
|
|||||||
|
|
||||||
self.external_sync_linearizer = Linearizer(name="external_sync_linearizer")
|
self.external_sync_linearizer = Linearizer(name="external_sync_linearizer")
|
||||||
|
|
||||||
# Start a LoopingCall in 30s that fires every 5s.
|
if self._presence_enabled:
|
||||||
# The initial delay is to allow disconnected clients a chance to
|
# Start a LoopingCall in 30s that fires every 5s.
|
||||||
# reconnect before we treat them as offline.
|
# The initial delay is to allow disconnected clients a chance to
|
||||||
def run_timeout_handler():
|
# reconnect before we treat them as offline.
|
||||||
return run_as_background_process(
|
def run_timeout_handler():
|
||||||
"handle_presence_timeouts", self._handle_timeouts
|
return run_as_background_process(
|
||||||
|
"handle_presence_timeouts", self._handle_timeouts
|
||||||
|
)
|
||||||
|
|
||||||
|
self.clock.call_later(
|
||||||
|
30, self.clock.looping_call, run_timeout_handler, 5000
|
||||||
)
|
)
|
||||||
|
|
||||||
self.clock.call_later(30, self.clock.looping_call, run_timeout_handler, 5000)
|
def run_persister():
|
||||||
|
return run_as_background_process(
|
||||||
|
"persist_presence_changes", self._persist_unpersisted_changes
|
||||||
|
)
|
||||||
|
|
||||||
def run_persister():
|
self.clock.call_later(60, self.clock.looping_call, run_persister, 60 * 1000)
|
||||||
return run_as_background_process(
|
|
||||||
"persist_presence_changes", self._persist_unpersisted_changes
|
|
||||||
)
|
|
||||||
|
|
||||||
self.clock.call_later(60, self.clock.looping_call, run_persister, 60 * 1000)
|
|
||||||
|
|
||||||
LaterGauge(
|
LaterGauge(
|
||||||
"synapse_handlers_presence_wheel_timer_size",
|
"synapse_handlers_presence_wheel_timer_size",
|
||||||
@ -299,7 +302,7 @@ class PresenceHandler(BasePresenceHandler):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Used to handle sending of presence to newly joined users/servers
|
# Used to handle sending of presence to newly joined users/servers
|
||||||
if hs.config.use_presence:
|
if self._presence_enabled:
|
||||||
self.notifier.add_replication_callback(self.notify_new_event)
|
self.notifier.add_replication_callback(self.notify_new_event)
|
||||||
|
|
||||||
# Presence is best effort and quickly heals itself, so lets just always
|
# Presence is best effort and quickly heals itself, so lets just always
|
||||||
|
Loading…
Reference in New Issue
Block a user