Skip to content

Commit 2e44fef

Browse files
authored
Merge pull request #346 from Police-Data-Accessibility-Project/mc_add_reporting_for_syncs
Add print notifications on how many entries synced.
2 parents fc767ec + 84abc10 commit 2e44fef

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/core/tasks/scheduled/sync/agency/operator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ def task_type(self) -> TaskType: #
2121
return TaskType.SYNC_AGENCIES
2222

2323
async def inner_task_logic(self):
24+
count_agencies_synced = 0
2425
params = await self.adb_client.get_agencies_sync_parameters()
2526
if params.page is None:
2627
params.page = 1
2728

2829
response = await self.pdap_client.sync_agencies(params)
30+
count_agencies_synced += len(response.agencies)
2931
request_count = 1
3032
while len(response.agencies) > 0:
3133
check_max_sync_requests_not_exceeded(request_count)
@@ -38,7 +40,9 @@ async def inner_task_logic(self):
3840
await self.adb_client.update_agencies_sync_progress(params.page)
3941

4042
response = await self.pdap_client.sync_agencies(params)
43+
count_agencies_synced += len(response.agencies)
4144
request_count += 1
4245

4346
await self.adb_client.mark_full_agencies_sync()
47+
print(f"Sync completeSynced {count_agencies_synced} agencies")
4448

src/core/tasks/scheduled/sync/data_sources/operator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ def task_type(self):
2121
return TaskType.SYNC_DATA_SOURCES
2222

2323
async def inner_task_logic(self):
24+
count_sources_synced = 0
25+
2426
params = await self.adb_client.get_data_sources_sync_parameters()
2527
if params.page is None:
2628
params.page = 1
2729

2830
response = await self.pdap_client.sync_data_sources(params)
31+
count_sources_synced += len(response.data_sources)
2932
request_count = 1
3033
while len(response.data_sources) > 0:
3134
check_max_sync_requests_not_exceeded(request_count)
@@ -38,6 +41,8 @@ async def inner_task_logic(self):
3841
await self.adb_client.update_data_sources_sync_progress(params.page)
3942

4043
response = await self.pdap_client.sync_data_sources(params)
44+
count_sources_synced += len(response.data_sources)
4145
request_count += 1
4246

4347
await self.adb_client.mark_full_data_sources_sync()
48+
print(f"Sync complete. Synced {count_sources_synced} data sources")

0 commit comments

Comments
 (0)