Prevent self re-unsubscription

This commit is contained in:
NIC619 2019-07-18 13:26:31 +08:00
parent f25d97fbd3
commit 89347be526
No known key found for this signature in database
GPG Key ID: 570C35F5C2D51B17

View File

@ -238,9 +238,11 @@ class Pubsub():
: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
if topic_id in self.my_topics:
del self.my_topics[topic_id]
del self.my_topics[topic_id]
# Create unsubscribe message
packet = rpc_pb2.RPC()