From cf15d9c873c49058cf530bc3a32b7458f0e35432 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 10 May 2023 11:59:44 +0200 Subject: [PATCH] backend: ensure cid is a UUID, remove unneeded inactive check on crawls (#842) * backend: ensure cid is a UUID, remove unneeded inactive check on crawls * add UUID cast to cancel only --- backend/btrixcloud/crawlconfigs.py | 2 +- backend/btrixcloud/operator.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/btrixcloud/crawlconfigs.py b/backend/btrixcloud/crawlconfigs.py index 9c6c1e1e..75c23924 100644 --- a/backend/btrixcloud/crawlconfigs.py +++ b/backend/btrixcloud/crawlconfigs.py @@ -905,7 +905,7 @@ async def update_config_crawl_stats(crawl_configs, crawls, cid: uuid.UUID): "lastCrawlSize": None, } - match_query = {"cid": cid, "finished": {"$ne": None}, "inactive": {"$ne": True}} + match_query = {"cid": cid, "finished": {"$ne": None}} cursor = crawls.find(match_query).sort("finished", pymongo.DESCENDING) results = await cursor.to_list(length=10_000) if results: diff --git a/backend/btrixcloud/operator.py b/backend/btrixcloud/operator.py index ace8a06c..7695d82b 100644 --- a/backend/btrixcloud/operator.py +++ b/backend/btrixcloud/operator.py @@ -296,7 +296,7 @@ class BtrixOperator(K8sAPI): return true if db mark_finished update succeeds""" try: redis = await self._get_redis(redis_url) - await self.mark_finished(redis, crawl_id, cid, status, state) + await self.mark_finished(redis, crawl_id, uuid.UUID(cid), status, state) return True # pylint: disable=bare-except except: