Skip to content

Commit

Permalink
Add more detail to pubsub debug
Browse files Browse the repository at this point in the history
  • Loading branch information
laffra committed Jan 23, 2024
1 parent 586c469 commit 268410f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ltk/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ def match(self, message, receiver, receiver_topic, handler):
def process_queue(self):
for key, message in list(self.queue.items()):
del self.queue[key] # remove the message from the queue
print("pubsub: remove from queue:", key, str(message)[:64])
print("pubsub: remove from queue:", key, message.topic, str(message.data)[:64])
handled = False
for subscriber in self.subscribers:
if self.match(message, *subscriber):
print("pubsub: matched:", key, str(message)[:64])
print("pubsub: matched:", key, message.topic, str(message.data)[:64])
handled = True
if not handled:
print("pubsub: put back on queue:", key, str(message)[:64])
print("pubsub: put back on queue:", key, message.topic, str(message.data)[:64])
self.queue[key] = message # put back the message onto the queue

def add_to_queue(self, message):
key = f"{_name}-{time.time()}"
print("pubsub: add to queue:", key, str(message)[:64])
print("pubsub: add to queue:", key, message.topic, str(message.data)[:64])
self.queue[key] = message

def publish(self, sender, receiver, topic, data):
Expand Down

0 comments on commit 268410f

Please sign in to comment.