Skip to content

Commit

Permalink
Add flag to allow pumping unranked scores
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed May 4, 2024
1 parent d167ce7 commit 67cee7a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osu.ElasticIndexer/Commands/Queue/PumpAllScoresCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class PumpAllScoresCommand
[Option("--switch", Description = "Update the configured schema in redis after completing.")]
public bool Switch { get; set; }

[Option("--include-unranked", Description = "Pump scores with ranked flag set to false to trigger deletion")]
public bool IncludeUnranked { get; set; }

private CancellationToken cancellationToken;

private UnrunnableProcessor processor = null!;
Expand Down Expand Up @@ -66,7 +69,7 @@ public int OnExecute(CancellationToken cancellationToken)
using (var mySqlConnection = processor.GetDatabaseConnection())

{
var chunks = ElasticModel.Chunk<Score>(mySqlConnection, "preserve = 1 AND ranked = 1", AppSettings.BatchSize, from);
var chunks = ElasticModel.Chunk<Score>(mySqlConnection, "preserve = 1 " + (IncludeUnranked ? string.Empty : "AND ranked = 1"), AppSettings.BatchSize, from);
Score? last = null;

foreach (var scores in chunks)
Expand Down

0 comments on commit 67cee7a

Please sign in to comment.