Skip to content

Commit f1d36a6

Browse files
committed
🐛 fix: Refine concurrency settings to resolve performance issues
1 parent f9cbdd9 commit f1d36a6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/crawler/contest_record_and_submission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def request_contest_records(
4242
]
4343
responses = await multi_http_request(
4444
{url: {"url": url, "method": "GET"} for url in url_list},
45-
concurrent_num=20 if data_region == "US" else 1,
45+
concurrent_num=20 if data_region == "US" else 50,
4646
)
4747
for res in responses:
4848
if res is None:

app/handler/submission.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ async def save_real_time_rank(
133133
for (username, data_region), rank_list in real_time_rank_map.items()
134134
]
135135
logger.info("updating real_time_rank field in ContestRecordArchive collection")
136-
await gather_with_limited_concurrency(tasks, max_con_num=20)
136+
# TODO OOM here
137+
await gather_with_limited_concurrency(tasks, max_con_num=5)
137138
logger.success(f"finished updating real_time_rank for {contest_name=}")
138139

139140

@@ -193,7 +194,8 @@ async def save_submission(
193194
for submission in submissions
194195
]
195196
logger.info("updating Submission collection")
196-
await gather_with_limited_concurrency(tasks, max_con_num=20)
197+
# TODO OOM here
198+
await gather_with_limited_concurrency(tasks, max_con_num=5)
197199
# Old submissions may be rejudged, must be deleted here, or will cause error when plotting.
198200
await Submission.find(
199201
Submission.contest_name == contest_name,

0 commit comments

Comments
 (0)