Don't continue until you mark the wiki as still in database

This commit is contained in:
Frisk 2020-10-29 20:36:48 +01:00
parent a5e7e04881
commit d79afc62a5
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -126,11 +126,9 @@ class RcQueue:
fetch_all = db_cursor.execute( fetch_all = db_cursor.execute(
'SELECT ROWID, webhook, wiki, lang, display, wikiid, rcid FROM rcgcdw WHERE rcid != -1 OR rcid IS NULL GROUP BY wiki ORDER BY ROWID ASC') 'SELECT ROWID, webhook, wiki, lang, display, wikiid, rcid FROM rcgcdw WHERE rcid != -1 OR rcid IS NULL GROUP BY wiki ORDER BY ROWID ASC')
self.to_remove = [x[0] for x in filter(self.filter_rc_active, all_wikis.items())] # first populate this list and remove wikis that are still in the db, clean up the rest self.to_remove = [x[0] for x in filter(self.filter_rc_active, all_wikis.items())] # first populate this list and remove wikis that are still in the db, clean up the rest
full = [] full = set()
for db_wiki in fetch_all.fetchall(): for db_wiki in fetch_all.fetchall():
domain = get_domain(db_wiki["wiki"]) domain = get_domain(db_wiki["wiki"])
if domain in full:
continue
try: try:
if db_wiki["wiki"] not in all_wikis: if db_wiki["wiki"] not in all_wikis:
raise AssertionError raise AssertionError
@ -140,6 +138,8 @@ class RcQueue:
all_wikis[db_wiki["wiki"]].rc_active = db_wiki["rcid"] all_wikis[db_wiki["wiki"]].rc_active = db_wiki["rcid"]
except ValueError: except ValueError:
pass pass
if domain in full:
continue
try: try:
current_domain: dict = self[domain] current_domain: dict = self[domain]
if not db_wiki["ROWID"] < current_domain["last_rowid"]: if not db_wiki["ROWID"] < current_domain["last_rowid"]:
@ -148,7 +148,7 @@ class RcQueue:
await self.start_group(domain, [QueuedWiki(db_wiki["wiki"], 20)]) await self.start_group(domain, [QueuedWiki(db_wiki["wiki"], 20)])
logger.info("A new domain group ({}) has been added since last time, adding it to the domain_list and starting a task...".format(domain)) logger.info("A new domain group ({}) has been added since last time, adding it to the domain_list and starting a task...".format(domain))
except ListFull: except ListFull:
full.append(domain) full.add(domain)
current_domain["last_rowid"] = db_wiki["ROWID"] current_domain["last_rowid"] = db_wiki["ROWID"]
continue continue
for wiki in self.to_remove: for wiki in self.to_remove: