Skip to content

Commit

Permalink
Add better logging around quick lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jun 11, 2024
1 parent 6fbe372 commit dd37749
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GlobalRankLookupCache/Controllers/BeatmapRankCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public BeatmapRankCache(int beatmapId, string highScoresTable)
using (var db = await Program.GetDatabaseConnection())
using (var cmd = db.CreateCommand())
{
Console.WriteLine($"performing quick lookup for {beatmapId}...");

cmd.CommandTimeout = 10;
cmd.CommandText = $"select count(*) from {highScoresTable} where beatmap_id = {beatmapId} and score > {score} and hidden = 0";
int pos = (int)(long)(await cmd.ExecuteScalarAsync())!;
Expand All @@ -41,7 +43,7 @@ public BeatmapRankCache(int beatmapId, string highScoresTable)
cmd.CommandText = $"select count(*) from {highScoresTable} where beatmap_id = {beatmapId} and hidden = 0";
int total = (int)(long)(await cmd.ExecuteScalarAsync())!;

Console.WriteLine($"quick lookup for {beatmapId} = {pos}/{total}");
Console.WriteLine($"performed quick lookup for {beatmapId} = {pos}/{total}");

return (pos, total);
}
Expand Down

0 comments on commit dd37749

Please sign in to comment.