@@ -31,21 +31,13 @@ public class WatchHighScoresCommand
3131 [ Option ( CommandOptionType . SingleValue , Template = "--ruleset-id" ) ]
3232 public int RulesetId { get ; set ; }
3333
34- /// <summary>
35- /// When set to <c>true</c>, scores will not be queued to the score statistics processor,
36- /// instead being sent straight to the elasticsearch indexing queue.
37- /// </summary>
38- [ Option ( CommandOptionType . SingleOrNoValue , Template = "--skip-score-processor" ) ]
39- public bool SkipScoreProcessor { get ; set ; }
40-
4134 [ Option ( CommandOptionType . SingleOrNoValue , Template = "--dry-run" ) ]
4235 public bool DryRun { get ; set ; }
4336
4437 private long lastCommitTimestamp ;
4538 private long startupTimestamp ;
4639
47- private ElasticQueuePusher ? elasticQueueProcessor ;
48- private ScoreStatisticsQueueProcessor ? scoreStatisticsQueueProcessor ;
40+ private ScoreStatisticsQueueProcessor scoreStatisticsQueueProcessor = null ! ;
4941
5042 /// <summary>
5143 /// The number of seconds between console progress reports.
@@ -101,16 +93,8 @@ public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
10193 await Task . Delay ( 10000 , cancellationToken ) ;
10294 }
10395
104- if ( SkipScoreProcessor )
105- {
106- elasticQueueProcessor = new ElasticQueuePusher ( ) ;
107- Console . WriteLine ( $ "Indexing to elasticsearch queue(s) { elasticQueueProcessor . ActiveQueues } ") ;
108- }
109- else
110- {
111- scoreStatisticsQueueProcessor = new ScoreStatisticsQueueProcessor ( ) ;
112- Console . WriteLine ( $ "Pushing imported scores to redis queue { scoreStatisticsQueueProcessor . QueueName } ") ;
113- }
96+ scoreStatisticsQueueProcessor = new ScoreStatisticsQueueProcessor ( ) ;
97+ Console . WriteLine ( $ "Pushing imported scores to redis queue { scoreStatisticsQueueProcessor . QueueName } ") ;
11498
11599 if ( DryRun )
116100 Console . WriteLine ( "RUNNING IN DRY RUN MODE." ) ;
@@ -184,7 +168,7 @@ public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
184168 continue ;
185169 }
186170
187- var inserter = new BatchInserter ( ruleset , highScores , importLegacyPP : SkipScoreProcessor , dryRun : DryRun ) ;
171+ var inserter = new BatchInserter ( ruleset , highScores , dryRun : DryRun ) ;
188172
189173 while ( ! inserter . Task . IsCompleted )
190174 {
@@ -216,28 +200,13 @@ public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
216200
217201 private void pushCompletedScoreToQueue ( BatchInserter inserter )
218202 {
219- if ( scoreStatisticsQueueProcessor != null )
220- {
221- var scoreStatisticsItems = inserter . ScoreStatisticsItems . ToList ( ) ;
222-
223- if ( scoreStatisticsItems . Any ( ) )
224- {
225- if ( ! DryRun )
226- scoreStatisticsQueueProcessor . PushToQueue ( scoreStatisticsItems ) ;
227- Console . WriteLine ( $ "Queued { scoreStatisticsItems . Count } item(s) for statistics processing") ;
228- }
229- }
203+ var scoreStatisticsItems = inserter . ScoreStatisticsItems . ToList ( ) ;
230204
231- if ( elasticQueueProcessor != null )
205+ if ( scoreStatisticsItems . Any ( ) )
232206 {
233- var elasticItems = inserter . ElasticScoreItems . ToList ( ) ;
234-
235- if ( elasticItems . Any ( ) )
236- {
237- if ( ! DryRun )
238- elasticQueueProcessor . PushToQueue ( elasticItems ) ;
239- Console . WriteLine ( $ "Queued { elasticItems . Count } item(s) for indexing") ;
240- }
207+ if ( ! DryRun )
208+ scoreStatisticsQueueProcessor . PushToQueue ( scoreStatisticsItems ) ;
209+ Console . WriteLine ( $ "Queued { scoreStatisticsItems . Count } item(s) for statistics processing") ;
241210 }
242211 }
243212
@@ -248,7 +217,6 @@ private void outputProgress()
248217 if ( ( currentTimestamp - lastCommitTimestamp ) / 1000f >= seconds_between_report )
249218 {
250219 int inserted = Interlocked . Exchange ( ref BatchInserter . CurrentReportInsertCount , 0 ) ;
251- int deleted = Interlocked . Exchange ( ref BatchInserter . CurrentReportDeleteCount , 0 ) ;
252220
253221 // Only set startup timestamp after first insert actual insert/update run to avoid weighting during catch-up.
254222 if ( inserted > 0 && startupTimestamp == 0 )
@@ -258,7 +226,7 @@ private void outputProgress()
258226 double processingRate = BatchInserter . TotalInsertCount / secondsSinceStart ;
259227
260228 Console . WriteLine ( $ "Inserting up to { lastQueueId : N0} : "
261- + $ "{ BatchInserter . TotalInsertCount : N0} ins { BatchInserter . TotalDeleteCount : N0 } del { BatchInserter . TotalSkipCount : N0 } skip (+ { inserted : N0 } new + { deleted : N0 } del) { processingRate : N0} /s") ;
229+ + $ "{ BatchInserter . TotalInsertCount : N0} inserted { processingRate : N0} /s") ;
262230
263231 lastCommitTimestamp = currentTimestamp ;
264232 }
@@ -269,7 +237,7 @@ private void outputFinalStats()
269237 Console . WriteLine ( ) ;
270238 Console . WriteLine ( ) ;
271239 Console . WriteLine ( $ "Cancelled after { ( DateTimeOffset . Now - startedAt ) . TotalSeconds } seconds.") ;
272- Console . WriteLine ( $ "Final stats: { BatchInserter . TotalInsertCount } inserted, { BatchInserter . TotalSkipCount } skipped, { BatchInserter . TotalDeleteCount } deleted ") ;
240+ Console . WriteLine ( $ "Final stats: { BatchInserter . TotalInsertCount } inserted") ;
273241 Console . WriteLine ( $ "Resume from start id { lastQueueId } ") ;
274242 Console . WriteLine ( ) ;
275243 Console . WriteLine ( ) ;
0 commit comments