Fix even more issues with the linked_revs considered cache

This commit is contained in:
Stephan Kulow 2022-10-27 10:16:20 +02:00
parent 996b90dd7a
commit 65000cd586
2 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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