mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix: issue #292, wrong key was used to clean _slots internal dictionary
This commit is contained in:
@ -162,9 +162,9 @@ class BECDispatcher:
|
|||||||
return
|
return
|
||||||
self.client.connector.unregister(topics, cb=connected_slot)
|
self.client.connector.unregister(topics, cb=connected_slot)
|
||||||
topics_str, _ = self.client.connector._convert_endpointinfo(topics)
|
topics_str, _ = self.client.connector._convert_endpointinfo(topics)
|
||||||
self._slots[slot].difference_update(set(topics_str))
|
self._slots[connected_slot].difference_update(set(topics_str))
|
||||||
if not self._slots[slot]:
|
if not self._slots[connected_slot]:
|
||||||
del self._slots[slot]
|
del self._slots[connected_slot]
|
||||||
|
|
||||||
def disconnect_topics(self, topics: Union[str, list]):
|
def disconnect_topics(self, topics: Union[str, list]):
|
||||||
self.client.connector.unregister(topics)
|
self.client.connector.unregister(topics)
|
||||||
|
@ -92,7 +92,9 @@ def test_dispatcher_2_cb_same_topic(bec_dispatcher_w_connector, qtbot, send_msg_
|
|||||||
bec_dispatcher.connect_slot(cb1, "topic1")
|
bec_dispatcher.connect_slot(cb1, "topic1")
|
||||||
bec_dispatcher.connect_slot(cb2, "topic1")
|
bec_dispatcher.connect_slot(cb2, "topic1")
|
||||||
assert len(bec_dispatcher.client.connector._topics_cb) == 1
|
assert len(bec_dispatcher.client.connector._topics_cb) == 1
|
||||||
|
assert len(bec_dispatcher._slots) == 2
|
||||||
bec_dispatcher.disconnect_slot(cb1, "topic1")
|
bec_dispatcher.disconnect_slot(cb1, "topic1")
|
||||||
|
assert len(bec_dispatcher._slots) == 1
|
||||||
|
|
||||||
send_msg_event.set()
|
send_msg_event.set()
|
||||||
qtbot.wait(10)
|
qtbot.wait(10)
|
||||||
|
Reference in New Issue
Block a user