mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Don't let the remote offline serial list grow arbitrarily large
This commit is contained in:
parent
8a785c3006
commit
b3bda8a75f
@ -36,6 +36,9 @@ metrics = synapse.metrics.get_metrics_for(__name__)
|
||||
# Don't bother bumping "last active" time if it differs by less than 60 seconds
|
||||
LAST_ACTIVE_GRANULARITY = 60*1000
|
||||
|
||||
# Keep no more than this number of offline serial revisions
|
||||
MAX_OFFLINE_SERIALS = 1000
|
||||
|
||||
|
||||
# TODO(paul): Maybe there's one of these I can steal from somewhere
|
||||
def partition(l, func):
|
||||
@ -722,6 +725,8 @@ class PresenceHandler(BaseHandler):
|
||||
0,
|
||||
(self._user_cachemap_latest_serial, set([user.to_string()]))
|
||||
)
|
||||
while len(self._remote_offline_serials) > MAX_OFFLINE_SERIALS:
|
||||
self._remote_offline_serials.pop() # remove the oldest
|
||||
del self._user_cachemap[user]
|
||||
|
||||
for poll in content.get("poll", []):
|
||||
|
Loading…
Reference in New Issue
Block a user