Skip to content

Commit 4f121fb

Browse files
authored
Update precompute migration to only update active workflows (#833)
1 parent 8281ba7 commit 4f121fb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backend/btrixcloud/migrations/migration_0006_precompute_crawl_stats.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ async def migrate_up(self):
2323
crawl_configs = self.mdb["crawl_configs"]
2424
crawls = self.mdb["crawls"]
2525

26-
configs = [res async for res in crawl_configs.find({})]
26+
configs = [res async for res in crawl_configs.find({"inactive": {"$ne": True}})]
2727
if not configs:
2828
return
2929

3030
for config in configs:
31-
await update_config_crawl_stats(crawl_configs, crawls, config["_id"])
31+
config_id = config["_id"]
32+
try:
33+
await update_config_crawl_stats(crawl_configs, crawls, config_id)
34+
# pylint: disable=broad-exception-caught
35+
except Exception as err:
36+
print(f"Unable to update workflow {config_id}: {err}", flush=True)

0 commit comments

Comments
 (0)