summary refs log tree commit diff
path: root/synapse/handlers/profile.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-12-31 11:23:24 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-12-31 11:23:24 +0000
commit5fc0dd81266359c53dec589426af33a10f5f1100 (patch)
tree1b931a45f2a23ae2b7c78f705f1ea87b58dd252f /synapse/handlers/profile.py
parentAllow users to click account renewal links multiple times without hitting an ... (diff)
parentMerge branch 'master' into develop (diff)
downloadsynapse-5fc0dd81266359c53dec589426af33a10f5f1100.tar.xz
Merge commit '74976a8e4' into dinsic
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r--synapse/handlers/profile.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py

index c301ac0631..9329ffc68a 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py
@@ -42,14 +42,16 @@ MAX_DISPLAYNAME_LEN = 256 MAX_AVATAR_URL_LEN = 1000 -class BaseProfileHandler(BaseHandler): +class ProfileHandler(BaseHandler): """Handles fetching and updating user profile information. - BaseProfileHandler can be instantiated directly on workers and will - delegate to master when necessary. The master process should use the - subclass MasterProfileHandler + ProfileHandler can be instantiated directly on workers and will + delegate to master when necessary. """ + PROFILE_UPDATE_MS = 60 * 1000 + PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000 + PROFILE_REPLICATE_INTERVAL = 2 * 60 * 1000 def __init__(self, hs): @@ -68,7 +70,7 @@ class BaseProfileHandler(BaseHandler): self.allowed_avatar_mimetypes = hs.config.allowed_avatar_mimetypes self.replicate_user_profiles_to = hs.config.replicate_user_profiles_to - if hs.config.worker_app is None: + if hs.config.run_background_tasks: self.clock.looping_call( self._start_update_remote_profile_cache, self.PROFILE_UPDATE_MS ) @@ -571,20 +573,6 @@ class BaseProfileHandler(BaseHandler): raise SynapseError(403, "Profile isn't available", Codes.FORBIDDEN) raise - -class MasterProfileHandler(BaseProfileHandler): - PROFILE_UPDATE_MS = 60 * 1000 - PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000 - - def __init__(self, hs): - super().__init__(hs) - - assert hs.config.worker_app is None - - self.clock.looping_call( - self._start_update_remote_profile_cache, self.PROFILE_UPDATE_MS - ) - def _start_update_remote_profile_cache(self): return run_as_background_process( "Update remote profile", self._update_remote_profile_cache