From 65000cd586e609a05b5ecc9fa5cde6ba43bdc483 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 27 Oct 2022 10:16:20 +0200 Subject: [PATCH] Fix even more issues with the linked_revs considered cache --- lib/db.py | 7 ++++++- lib/importer.py | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/db.py b/lib/db.py index 23e54bd..ecf507a 100644 --- a/lib/db.py +++ b/lib/db.py @@ -207,9 +207,14 @@ class DB: "UPDATE scheme SET version=18", ) schemes[19] = ( - "CREATE INDEX ON files(revision_id);", + "CREATE INDEX ON files(revision_id)", "UPDATE scheme SET version=19", ) + schemes[20] = ( + "CREATE INDEX ON linked_revs(linked_id)", + "CREATE INDEX ON linked_revs(considered)", + "UPDATE scheme SET version=20", + ) schema_version = self.schema_version() if (schema_version + 1) not in schemes: return diff --git a/lib/importer.py b/lib/importer.py index 249d5a2..5d56824 100644 --- a/lib/importer.py +++ b/lib/importer.py @@ -191,7 +191,7 @@ class Importer: if not prev: with db.cursor() as cur: cur.execute( - "UPDATE linked_revs SET considered=TRUE where revision_id=%s", + "UPDATE linked_revs SET considered=TRUE where linked_id=%s", (rev.dbid,), ) return @@ -210,7 +210,7 @@ class Importer: continue last_linked = linked cur.execute( - "UPDATE linked_revs SET considered=TRUE where revision_id=%s", + "UPDATE linked_revs SET considered=TRUE where linked_id=%s", (rev.dbid,), ) if not last_linked: @@ -224,7 +224,7 @@ class Importer: ) if cur.fetchone(): cur.execute( - "UPDATE linked_revs SET considered=TRUE where revision_id=%s", + "UPDATE linked_revs SET considered=TRUE where linked_id=%s", (rev.dbid,), ) return