Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions backend/btrixcloud/basecrawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,21 @@ async def _delete_crawl_files(

return size

async def delete_crawl_files(self, crawl_id: str, oid: UUID):
"""Delete crawl files"""
async def delete_failed_crawl_files(self, crawl_id: str, oid: UUID):
"""Delete crawl files for failed crawl"""
crawl = await self.get_base_crawl(crawl_id)
org = await self.orgs.get_org_by_id(oid)
return await self._delete_crawl_files(crawl, org)
await self._delete_crawl_files(crawl, org)
await self.crawls.find_one_and_update(
{"_id": crawl_id, "oid": oid},
{
"$set": {
"files": [],
"fileCount": 0,
"fileSize": 0,
}
},
)

async def delete_all_crawl_qa_files(self, crawl_id: str, org: Organization):
"""Delete files for all qa runs in a crawl"""
Expand Down
2 changes: 1 addition & 1 deletion backend/btrixcloud/operator/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ async def do_crawl_finished_tasks(
)

if state in FAILED_STATES:
await self.crawl_ops.delete_crawl_files(crawl.id, crawl.oid)
await self.crawl_ops.delete_failed_crawl_files(crawl.id, crawl.oid)
await self.page_ops.delete_crawl_pages(crawl.id, crawl.oid)

await self.event_webhook_ops.create_crawl_finished_notification(
Expand Down
Loading