We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d1a339 commit 983267aCopy full SHA for 983267a
sogs/events.py
@@ -16,7 +16,7 @@
16
from flask import g
17
18
# pools for event propagation
19
-_pools = defaultdict(list)
+_pools = defaultdict(set)
20
21
status_OK = 'OK'
22
status_ERR = 'ERROR'
@@ -111,7 +111,7 @@ def handle_subscribe(*events, conn=None):
111
112
global _pools
113
for name in sub:
114
- _pools[name].append(conn)
+ _pools[name].add(conn)
115
app.logger.debug(f"sub {conn} to {len(sub)} events")
116
117
@@ -127,7 +127,8 @@ def handle_unsubscribe(*events, conn=None):
127
128
129
for name in unsub:
130
- _pools[name].remove(conn)
+ if conn in _pools[name]:
131
+ _pools[name].remove(conn)
132
app.logger.debug(f"unsub {conn} to {len(unsub)} events")
133
134
0 commit comments