From 0e93f9cd5dd76f88483c1bf4565a18b7f16e34c8 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 25 Mar 2018 13:10:22 -0700 Subject: [PATCH] Update where the stream marker gets set to avoid the possibility of duplicate messages during the transition. --- pnut-bridge.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pnut-bridge.py b/pnut-bridge.py index 4d0f70b..f4da8b0 100644 --- a/pnut-bridge.py +++ b/pnut-bridge.py @@ -196,10 +196,12 @@ class ChannelMonitor(threading.Thread): # update the last message id if len(messages) > 0: room.pnut_since = messages[0].id - if 'max_id' in meta: - self.update_marker(room.pnut_chan, meta.max_id) db.session.commit() + # update the stream marker + if 'max_id' in meta: + self.update_marker(room.pnut_chan, meta.max_id) + # empty the queue to the matrix room for item in pqueue: self.txId += 1