@@ -36,6 +36,8 @@ public class MarkNonPreservedScoresCommand
3636 [ Option ( Description = "Optional where clause" , Template = "--where" ) ]
3737 public string Where { get ; set ; } = "1 = 1" ;
3838
39+ private int totalMarked ;
40+
3941 public async Task < int > OnExecuteAsync ( CancellationToken cancellationToken )
4042 {
4143 if ( ! DryRun )
@@ -53,16 +55,21 @@ public async Task<int> OnExecuteAsync(CancellationToken cancellationToken)
5355 int [ ] userIds = ( await db . QueryAsync < int > ( $ "SELECT `user_id` FROM { databaseInfo . UserStatsTable } WHERE { Where } ") ) . ToArray ( ) ;
5456 Console . WriteLine ( $ "Fetched { userIds . Length } users") ;
5557
56- foreach ( int userId in userIds )
57- await processUser ( db , userId , cancellationToken ) ;
58+ for ( int i = 0 ; i < userIds . Length ; i ++ )
59+ {
60+ await processUser ( db , userIds [ i ] , cancellationToken ) ;
61+
62+ if ( i > 0 && i % 100 == 0 )
63+ Console . WriteLine ( $ "Processed { i : N0} of { userIds . Length : N0} users ({ totalMarked : N0} marked)") ;
64+ }
5865 }
5966
6067 return 0 ;
6168 }
6269
6370 private async Task processUser ( MySqlConnection db , int userId , CancellationToken cancellationToken )
6471 {
65- int markedCount = 0 ;
72+ int userMarkedCount = 0 ;
6673
6774 var parameters = new
6875 {
@@ -140,7 +147,9 @@ STRAIGHT_JOIN scores s FORCE INDEX (beatmap_user_index)
140147 }
141148
142149 Debug . Assert ( preservedAlternatives . Any ( ) ) ;
143- markedCount ++ ;
150+
151+ userMarkedCount ++ ;
152+ totalMarked ++ ;
144153
145154 if ( Verbose )
146155 {
@@ -167,12 +176,12 @@ STRAIGHT_JOIN scores s FORCE INDEX (beatmap_user_index)
167176 if ( Verbose )
168177 {
169178 Console . WriteLine ( ) ;
170- Console . WriteLine ( $ "Scores marked for deletion: { markedCount : N0} ") ;
171- Console . WriteLine ( $ "Scores kept: { scores . Count ( ) - markedCount : N0} ") ;
179+ Console . WriteLine ( $ "Scores marked for deletion: { userMarkedCount : N0} ") ;
180+ Console . WriteLine ( $ "Scores kept: { scores . Count ( ) - userMarkedCount : N0} ") ;
172181 }
173- else if ( markedCount > 0 )
182+ else if ( userMarkedCount > 0 )
174183 {
175- Console . WriteLine ( $ " { markedCount : N0} marked for deletion") ;
184+ Console . WriteLine ( $ " { userMarkedCount : N0} marked for deletion") ;
176185 }
177186 }
178187
0 commit comments