Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def publish(self, message_or_topic, payload=None, qos=0, retain=False, **kwargs):
if isinstance(message_or_topic, Message):
message = message_or_topic
else:
message = Message(message_or_topic, payload, qos=qos, retain=retain, **kwargs)
mid, package = self._connection.publish(message)
if qos > 0:
self._persistent_storage.push_message_nowait(mid, package)
def publish(self, message_or_topic, payload=None, qos=0, retain=False, **kwargs):
if isinstance(message_or_topic, Message):
message = message_or_topic
else:
message = Message(message_or_topic, payload, qos=qos, retain=retain, **kwargs)
mid, package = self._connection.publish(message)
if qos > 0:
self._persistent_storage.push_message_nowait(mid, package)