Skip to content

Commit

Permalink
use lock when removing subscribers, tweak log message
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Oct 21, 2024
1 parent d0660a1 commit c0dcdbb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def jetstream():
arroba.util.sign(label, privkey)
labels['labels'].append(label)

logger.info(f'emitting to {len(subscribers)} subscribers: {uri} {labels}')
logger.info(f'emitting {len(labels["labels"])} to {len(subscribers)} subscribers for {uri} ')
for sub in subscribers:
sub.put(labels)

Expand All @@ -145,7 +145,8 @@ def subscribe_labels(cursor=None):
while True:
yield ({'op': 1, 't': '#labels'}, labels.get())
finally:
subscribers.remove(labels)
with subscribers_lock:
subscribers.remove(labels)


# must be after subscription XRPC methods are registered
Expand Down

0 comments on commit c0dcdbb

Please sign in to comment.