Fix the fake revisions after introduction of cache

The way I stored it in the linked_revs was the wrong way
This commit is contained in:
Stephan Kulow 2022-10-27 07:33:46 +02:00
parent 9bd6643e8a
commit 38e4996280
2 changed files with 31 additions and 32 deletions

View File

@ -200,13 +200,12 @@ class DBRevision:
return self._files return self._files
@staticmethod @staticmethod
def requests_to_fetch(db, project, package): def requests_to_fetch(db):
with db.cursor() as cur: with db.cursor() as cur:
cur.execute( cur.execute(
"""SELECT request_number FROM revisions revs LEFT JOIN requests """SELECT request_number FROM revisions revs LEFT JOIN requests
reqs ON reqs.number=revs.request_number WHERE reqs.id is null AND reqs ON reqs.number=revs.request_number WHERE reqs.id is null AND
revs.request_number IS NOT NULL and project=%s AND package=%s;""", revs.request_number IS NOT NULL""",
(project, package),
) )
return [row[0] for row in cur.fetchall()] return [row[0] for row in cur.fetchall()]

View File

@ -181,7 +181,7 @@ class Importer:
def find_fake_revisions(self, db): def find_fake_revisions(self, db):
with db.cursor() as cur: with db.cursor() as cur:
cur.execute( cur.execute(
"SELECT * from revisions WHERE id in (SELECT revision_id from linked_revs WHERE considered=FALSE)" "SELECT * from revisions WHERE id in (SELECT linked_id from linked_revs WHERE considered=FALSE)"
) )
for row in cur.fetchall(): for row in cur.fetchall():
self._find_fake_revision(db, DBRevision(row)) self._find_fake_revision(db, DBRevision(row))
@ -268,7 +268,6 @@ class Importer:
self.fetch_all_linked_packages(db, project, self.package) self.fetch_all_linked_packages(db, project, self.package)
# all remaining, no filtering here # all remaining, no filtering here
self.find_linked_revs(db) self.find_linked_revs(db)
self.find_fake_revisions(db)
missing_users = User.missing_users(db) missing_users = User.missing_users(db)
for userid in missing_users: for userid in missing_users:
@ -276,6 +275,7 @@ class Importer:
if missing_user: if missing_user:
missing_user.import_into_db(db) missing_user.import_into_db(db)
self.find_fake_revisions(db)
for rev in self.revisions_without_files(db): for rev in self.revisions_without_files(db):
with db.cursor() as cur: with db.cursor() as cur:
cur.execute( cur.execute(
@ -300,7 +300,7 @@ class Importer:
else: else:
rev.set_broken(db) rev.set_broken(db)
for number in DBRevision.requests_to_fetch(db, project, self.package): for number in DBRevision.requests_to_fetch(db):
self.obs.request(number).import_into_db(db) self.obs.request(number).import_into_db(db)
db.conn.commit() db.conn.commit()