Skip to content

Commit

Permalink
Make adding upload pages and updating collections async
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Jan 30, 2025
1 parent a4a5ff1 commit 94902f8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions backend/btrixcloud/uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ async def _create_upload(
self.event_webhook_ops.create_upload_finished_notification(crawl_id, org.id)
)

await self.page_ops.add_crawl_pages_to_db_from_wacz(crawl_id)

if collections:
await self.colls.update_crawl_collections(crawl_id)
asyncio.create_task(
self._add_pages_and_update_collections(crawl_id, collections)
)

await self.orgs.inc_org_bytes_stored(org.id, file_size, "upload")

Expand All @@ -207,6 +206,13 @@ async def _create_upload(

return {"id": crawl_id, "added": True, "storageQuotaReached": quota_reached}

async def _add_pages_and_update_collections(
crawl_id: str, collections: Optional[List[str]] = None
):
await self.page_ops.add_crawl_pages_to_db_from_wacz(crawl_id)
if collections:
await self.colls.update_crawl_collections(crawl_id)

async def delete_uploads(
self,
delete_list: DeleteCrawlList,
Expand Down

0 comments on commit 94902f8

Please sign in to comment.