Prevent self re-subscription

This commit is contained in:
NIC619 2019-07-15 16:32:05 +08:00
parent 6d9ec7a9c5
commit f25d97fbd3
No known key found for this signature in database
GPG Key ID: 570C35F5C2D51B17

View File

@ -209,6 +209,10 @@ class Pubsub():
:param topic_id: topic_id to subscribe to
"""
# Already subscribed
if topic_id in self.my_topics:
return self.my_topics[topic_id]
# Map topic_id to blocking queue
self.my_topics[topic_id] = asyncio.Queue()