1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index 3c3262a88c..305fd00fc0 100644
--- a/synapse/push/pusherpool.py
+++ b/synapse/push/pusherpool.py
@@ -64,6 +64,8 @@ class PusherPool:
self._pusher_shard_config = hs.config.push.pusher_shard_config
self._instance_name = hs.get_instance_name()
+ self._account_validity = hs.config.account_validity
+
# map from user id to app_id:pushkey to pusher
self.pushers = {} # type: Dict[str, Dict[str, Union[HttpPusher, EmailPusher]]]
@@ -190,6 +192,14 @@ class PusherPool:
for u in users_affected:
if u in self.pushers:
+ # Don't push if the user account has expired
+ if self._account_validity.enabled:
+ expired = await self.store.is_account_expired(
+ u, self.clock.time_msec()
+ )
+ if expired:
+ continue
+
for p in self.pushers[u].values():
p.on_new_notifications(min_stream_id, max_stream_id)
@@ -210,6 +220,14 @@ class PusherPool:
for u in users_affected:
if u in self.pushers:
+ # Don't push if the user account has expired
+ if self._account_validity.enabled:
+ expired = yield self.store.is_account_expired(
+ u, self.clock.time_msec()
+ )
+ if expired:
+ continue
+
for p in self.pushers[u].values():
p.on_new_receipts(min_stream_id, max_stream_id)
|