Skip to content

Commit 0aa3d99

Browse files
committed
api: prevent durable subscriber cursor rewind
1 parent d20bdab commit 0aa3d99

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

api/pubsub_mongo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,10 @@ async def _update_subscriber_state(
283283
):
284284
"""Update subscriber's last_event_id and last_poll"""
285285
col = self._mongo_db[self.SUBSCRIBER_STATE_COLLECTION]
286-
update = {"last_event_id": last_event_id}
286+
update = {"$max": {"last_event_id": last_event_id}}
287287
if last_poll:
288-
update["last_poll"] = last_poll
289-
await col.update_one({"subscriber_id": subscriber_id}, {"$set": update})
288+
update["$set"] = {"last_poll": last_poll}
289+
await col.update_one({"subscriber_id": subscriber_id}, update)
290290

291291
@staticmethod
292292
def _decode_redis_message(msg: Dict) -> Dict:

0 commit comments

Comments
 (0)