Skip to content

Commit

Permalink
Add ability to specify a min / max pp range to reprocess
Browse files Browse the repository at this point in the history
For partial processing, this becomes quite useful. For instance, we
could do a quick pass on all scores that "matter", or vice-versa.

I'm currently using this to process lower pp scores eagerly, as we don't
need to stop-the-world to update insignificant scores' PP values.
  • Loading branch information
peppy committed Oct 29, 2024
1 parent dd237d3 commit 23bfe4c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public class UpdateAllScoresCommand : PerformanceCommand
[Option(Description = "Score ID to start processing from.")]
public ulong From { get; set; }

[Option(Description = "The minimum PP of a score to reprocess.", LongName = "min-pp", ShortName = "p1")]
public float MinPP { get; set; } = 0;

[Option(Description = "The maximum PP of a score to reprocess.", LongName = "max-pp", ShortName = "pu")]
public float MaxPP { get; set; } = float.MaxValue;

/// <summary>
/// Whether to adjust processing rate based on slave latency. Defaults to <c>false</c>.
/// </summary>
Expand All @@ -50,10 +56,12 @@ protected override async Task<int> ExecuteAsync(CancellationToken cancellationTo

string sort = Backwards ? "DESC" : "ASC";

var scoresQuery = db.Query<SoloScore>($"SELECT * FROM scores WHERE `id` > @ScoreId AND `id` <= @LastScoreId ORDER BY `id` {sort}", new
var scoresQuery = db.Query<SoloScore>($"SELECT * FROM scores WHERE `id` > @ScoreId AND `id` <= @LastScoreId AND `pp` BETWEEN @minPP AND @maxPP ORDER BY `id` {sort}", new
{
ScoreId = currentScoreId,
LastScoreId = lastScoreId,
minPP = MinPP,
maxPP = MaxPP,
}, buffered: false);

using var scoresEnum = scoresQuery.GetEnumerator();
Expand Down

0 comments on commit 23bfe4c

Please sign in to comment.