Skip to content

Commit 11ff822

Browse files
committed
refactor: await scheduling for battle polling
1 parent fd0ca22 commit 11ff822

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

server/src/config/agenda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ agenda.define("battle:start", async (job: Job<{ battleId: number }>) => {
4747

4848
const participants = await db.getBattleParticipants(battleId);
4949

50-
agenda.every("1 minute", "battle:poll-submissions", {
50+
await agenda.every("1 minute", "battle:poll-submissions", {
5151
battle: battle,
5252
problems: problems,
5353
participants: participants,
5454
battleId: battleId,
5555
});
5656

57-
agenda.schedule(
57+
await agenda.schedule(
5858
new Date(
5959
new Date(battle.start_time).getTime() + battle.duration_min * 60 * 1000
6060
),

server/src/utils/codeforces.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,19 @@ export class CFClient {
186186
});
187187
}
188188

189+
async getSolvedProblems(handle: string) {
190+
// const submissions = await this.getSubmissions(handle);
191+
// const solvedProblems = new Set<string>();
192+
193+
// for (const sub of submissions) {
194+
// if (sub.verdict === "OK") {
195+
// solvedProblems.add(sub.problem.id);
196+
// }
197+
// }
198+
199+
// return Array.from(solvedProblems);
200+
}
201+
189202
async chooseProblems(minRating: number, maxRating: number, count: number) {
190203
const problems = await this.getProblemList();
191204
const filteredProblems = problems.problems.filter(

0 commit comments

Comments
 (0)