Skip to content

Commit 513f23e

Browse files
authored
Merge pull request #8 from SysSn13/dev
add 5 minutes delay for upcoming contests
2 parents ddf3b9a + a7cb536 commit 513f23e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

services/job-queues/jobScheduler.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ scheduler.process("contestScheduler", async (job, done) => {
1818
let cnt = 0;
1919

2020
contests.forEach((contest) => {
21+
let remainingTime = getRemainingTime(contest.endTime);
22+
if (remainingTime > 0) {
23+
remainingTime += 5 * 60 * 1000; // 5 minutes delay for upcoming contests
24+
}
2125
if (!contest.ratings_predicted && IsLatestContest(contest.endTime)) {
2226
contestPredictionQueue.add(
2327
"predictRatings",
@@ -27,7 +31,7 @@ scheduler.process("contestScheduler", async (job, done) => {
2731
{
2832
jobId: contest._id,
2933
attempts: 5,
30-
delay: getRemainingTime(contest.endTime) + 10 * 1000,
34+
delay: remainingTime,
3135
backoff: 10000,
3236
priority: 1,
3337
}

0 commit comments

Comments
 (0)