mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:06:07 -04:00
Optimise some references to hs.config (#7546)
These are surprisingly expensive, and we only really need to do them at startup.
This commit is contained in:
parent
2901f54359
commit
f4269694ce
8 changed files with 162 additions and 136 deletions
|
@ -48,6 +48,12 @@ class ResourceLimitsServerNotices(object):
|
|||
|
||||
self._notifier = hs.get_notifier()
|
||||
|
||||
self._enabled = (
|
||||
hs.config.limit_usage_by_mau
|
||||
and self._server_notices_manager.is_enabled()
|
||||
and not hs.config.hs_disabled
|
||||
)
|
||||
|
||||
async def maybe_send_server_notice_to_user(self, user_id):
|
||||
"""Check if we need to send a notice to this user, this will be true in
|
||||
two cases.
|
||||
|
@ -61,14 +67,7 @@ class ResourceLimitsServerNotices(object):
|
|||
Returns:
|
||||
Deferred
|
||||
"""
|
||||
if self._config.hs_disabled is True:
|
||||
return
|
||||
|
||||
if self._config.limit_usage_by_mau is False:
|
||||
return
|
||||
|
||||
if not self._server_notices_manager.is_enabled():
|
||||
# Don't try and send server notices unless they've been enabled
|
||||
if not self._enabled:
|
||||
return
|
||||
|
||||
timestamp = await self._store.user_last_seen_monthly_active(user_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue