Move the topics changed flag clear to the top;
to avoid a possible race condition with multiple adds and removals at the same time
This commit is contained in:
1 parent
3653ecf152
commit
babca4374d
1 file changed
+1
-1
+1
-1
@@ -173,6 +173,7 @@ class Websocket:
|
||||
if not self._topics_changed.is_set():
|
||||
# nothing to do
|
||||
return
|
||||
self._topics_changed.clear()
|
||||
current: Set[WebsocketTopic] = set(self.topics.values())
|
||||
# handle removed topics
|
||||
removed = self._submitted.difference(current)
|
||||
@@ -204,7 +205,6 @@ class Websocket:
|
||||
}
|
||||
)
|
||||
self._submitted.update(added)
|
||||
self._topics_changed.clear()
|
||||
|
||||
async def _gather_recv(self, messages: List[JsonType]):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user