Skip to content

Commit b9d7586

Browse files
committed
Recalculate collection stats after adding upload pages
1 parent 1b85550 commit b9d7586

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

backend/btrixcloud/colls.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,15 @@ async def download_collection(self, coll_id: UUID, org: Organization):
443443
resp, headers=headers, media_type="application/wacz+zip"
444444
)
445445

446+
async def recalculate_org_collection_counts_tags(self, org: Organization):
447+
"""Recalculate counts and tags for collections in org"""
448+
collections, _ = await self.list_collections(
449+
org,
450+
page_size=100_000,
451+
)
452+
for coll in collections:
453+
await self.update_collection_counts_and_tags(coll.id)
454+
446455
async def update_collection_counts_and_tags(self, collection_id: UUID):
447456
"""Set current crawl info in config when crawl begins"""
448457
crawl_count = 0

backend/btrixcloud/main_bg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ async def main():
6262
try:
6363
await page_ops.re_add_all_crawl_pages(org, crawl_type=crawl_type)
6464
await coll_ops.recalculate_org_collection_dates(org)
65+
await coll_ops.recalculate_org_collection_counts_tags(org)
6566
return 0
6667
# pylint: disable=broad-exception-caught
6768
except Exception:

0 commit comments

Comments
 (0)