Skip to content

Commit

Permalink
Add time estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjp93 committed Oct 7, 2024
1 parent de7a1d4 commit 10fb24d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions match/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,18 @@ def huge_match_import_task(hours_thresh=72, exclude_hours=24, break_early=True):
remaining_count = qs.count()
logger.info(f"Query loop. Found {remaining_count} new participants.")
i = -1
elapsed_start = time.perf_counter()
for participants in batched(qs.all().iterator(5000), batch):
jobs = []
summoners = []
for participant in participants:
i += 1
if i % 100 == 0:
elapsed = time.perf_counter() - elapsed_start
time_per_part = elapsed / (i or 1)
estimated_remaining = time_per_part * (remaining_count - i) / 60
logger.info(f"Finished importing {i} participants of about {remaining_count}.")
logger.info(f"Estimated time remaining for query loop: {estimated_remaining} minutes")
start_time = thresh
if summoner := Summoner.objects.filter(puuid=participant.puuid).first():
if break_early and summoner.huge_match_import_at and summoner.huge_match_import_at > thresh:
Expand Down

0 comments on commit 10fb24d

Please sign in to comment.