Skip to content

Commit

Permalink
Add early-bail for deletions so they don't attempt to queue for `scor…
Browse files Browse the repository at this point in the history
…e-statistics`
  • Loading branch information
peppy committed Mar 19, 2024
1 parent 4dd9254 commit aa105a1
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,17 @@ private async Task enqueueForFurtherProcessing(ulong firstId, ulong lastId, MySq
// on completion of PP processing, the score will be pushed to ES for indexing.
// the score refetch here is wasteful, but convenient and reliable, as the actual updated/inserted `SoloScore` row
// is not constructed anywhere before this...
var score = await connection.QuerySingleAsync<SoloScore>("SELECT * FROM `scores` WHERE `id` = @id",
new { id = scoreId });
var history = await connection.QuerySingleOrDefaultAsync<ProcessHistory>("SELECT * FROM `score_process_history` WHERE `score_id` = @id",
var score = await connection.QuerySingleOrDefaultAsync<SoloScore>("SELECT * FROM `scores` WHERE `id` = @id",
new { id = scoreId });

if (score == null)
{
// likely a deletion; already queued for ES above.
continue;
}

var history = await connection.QuerySingleOrDefaultAsync<ProcessHistory>("SELECT * FROM `score_process_history` WHERE `score_id` = @id", new { id = scoreId });

ScoreStatisticsItems.Add(new ScoreItem(score, history));
}
}
Expand Down

0 comments on commit aa105a1

Please sign in to comment.