You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{rows: existingRatings}=awaitdb.raw<{rows: {account_id: number,computed_mmr: number}[]}>(`SELECT account_id, computed_mmr FROM player_computed_mmr WHERE account_id IN (${accountIds.map(_=>'?').join(',')})`,[...accountIds]);
awaitdb.raw('INSERT INTO player_computed_mmr(account_id, computed_mmr) VALUES(?, ?) ON CONFLICT(account_id) DO UPDATE SET computed_mmr = EXCLUDED.computed_mmr',[p.account_id,newRating]);
59
-
}
60
-
// Delete row
61
-
awaitdb.raw('DELETE FROM rating_queue WHERE match_seq_num = ?',row.match_seq_num);
62
-
// Commit transaction
63
-
awaitdb.raw('COMMIT');
9
+
while(true){
10
+
const{ rows }=awaitdb.raw<{
11
+
rows: {
12
+
match_seq_num: number;
13
+
match_id: number;
14
+
pgroup: PGroup;
15
+
radiant_win: boolean;
16
+
gcdata: GcMatch|null;
17
+
}[];
18
+
}>(
19
+
'SELECT match_seq_num, match_id, pgroup, radiant_win, gcdata from rating_queue order by match_seq_num ASC LIMIT 1',
Copy file name to clipboardExpand all lines: svc/util/insert.ts
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -537,13 +537,22 @@ export async function insertMatch(
537
537
asyncfunctiondecideRate(match: InsertMatchInput){
538
538
// Decide whether to rate the match
539
539
// Rate a percentage of ranked matches
540
-
if(options.origin==='scanner'&&
540
+
if(
541
+
options.origin==='scanner'&&
541
542
options.type==='api'&&
542
543
'lobby_type'inmatch&&
543
544
match.lobby_type===7&&
544
545
match.match_id%100<Number(config.RATING_PERCENT)
545
546
){
546
-
awaitdb.raw('INSERT INTO rating_queue(match_seq_num, match_id, pgroup, radiant_win) VALUES(?, ?, ?, ?) ON CONFLICT DO NOTHING',[match.match_seq_num,match.match_id,JSON.stringify(pgroup),match.radiant_win]);
547
+
awaitdb.raw(
548
+
'INSERT INTO rating_queue(match_seq_num, match_id, pgroup, radiant_win) VALUES(?, ?, ?, ?) ON CONFLICT DO NOTHING',
0 commit comments