Prevent self re-unsubscription

This commit is contained in:
NIC619
2019-07-18 13:26:31 +08:00
parent f25d97fbd3
commit 89347be526

View File

@ -238,8 +238,10 @@ class Pubsub():
:param topic_id: topic_id to unsubscribe from :param topic_id: topic_id to unsubscribe from
""" """
# Return if we already unsubscribed from the topic
if topic_id not in self.my_topics:
return
# Remove topic_id from map if present # Remove topic_id from map if present
if topic_id in self.my_topics:
del self.my_topics[topic_id] del self.my_topics[topic_id]
# Create unsubscribe message # Create unsubscribe message