From cf70efb6a282127652e46f4c107b04d6e1e44097 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 2 Dec 2022 16:53:58 +0200 Subject: [PATCH] Clear backfill queue when chat is upgraded --- mautrix_telegram/db/portal.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mautrix_telegram/db/portal.py b/mautrix_telegram/db/portal.py index 13777e1f..3004533e 100644 --- a/mautrix_telegram/db/portal.py +++ b/mautrix_telegram/db/portal.py @@ -167,7 +167,10 @@ class Portal: "UPDATE portal SET tgid=$1, tg_receiver=$1, peer_type=$2 " "WHERE tgid=$3 AND tg_receiver=$3" ) - await self.db.execute(q, id, peer_type, self.tgid) + clear_queue = "DELETE FROM backfill_queue WHERE portal_tgid=$1 AND portal_tg_receiver=$2" + async with self.db.acquire() as conn, conn.transaction(): + await conn.execute(clear_queue, self.tgid, self.tg_receiver) + await conn.execute(q, id, peer_type, self.tgid) self.tgid = id self.tg_receiver = id self.peer_type = peer_type