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
This commit is contained in:
Ilya Kreymer 2023-05-10 11:59:44 +02:00 committed by GitHub
parent 42794cad46
commit cf15d9c873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

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

View File

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