mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 16:24:48 -04:00
Make the metrics less racy (#4061)
This commit is contained in:
parent
6a4d01ee94
commit
b69216f768
3 changed files with 22 additions and 16 deletions
|
@ -186,9 +186,9 @@ class Notifier(object):
|
|||
def count_listeners():
|
||||
all_user_streams = set()
|
||||
|
||||
for x in self.room_to_user_streams.values():
|
||||
for x in list(self.room_to_user_streams.values()):
|
||||
all_user_streams |= x
|
||||
for x in self.user_to_user_stream.values():
|
||||
for x in list(self.user_to_user_stream.values()):
|
||||
all_user_streams.add(x)
|
||||
|
||||
return sum(stream.count_listeners() for stream in all_user_streams)
|
||||
|
@ -196,7 +196,7 @@ class Notifier(object):
|
|||
|
||||
LaterGauge(
|
||||
"synapse_notifier_rooms", "", [],
|
||||
lambda: count(bool, self.room_to_user_streams.values()),
|
||||
lambda: count(bool, list(self.room_to_user_streams.values())),
|
||||
)
|
||||
LaterGauge(
|
||||
"synapse_notifier_users", "", [],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue