@@ -79,8 +79,10 @@ async fn standard(pool: &PgPool) -> Result<()> {
7979 return Ok ( ( ) ) ;
8080 }
8181
82- let stats = calculate_stats ( warp_stats) ;
83- for batch in stats. chunks ( UPDATE_BATCH_SIZE ) {
82+ let stats = calculate_stats ( "standard" , warp_stats) ;
83+ let total_batches = ( stats. len ( ) + UPDATE_BATCH_SIZE - 1 ) / UPDATE_BATCH_SIZE ;
84+ for ( i, batch) in stats. chunks ( UPDATE_BATCH_SIZE ) . enumerate ( ) {
85+ info ! ( "processing batch {} of {} for banner {}" , i + 1 , total_batches, "standard" ) ;
8486 database:: warps_stats_global:: standard:: set_bulk ( batch, pool) . await ?;
8587 }
8688
@@ -103,8 +105,10 @@ async fn special(pool: &PgPool) -> Result<()> {
103105 return Ok ( ( ) ) ;
104106 }
105107
106- let stats = calculate_stats ( warp_stats) ;
107- for batch in stats. chunks ( UPDATE_BATCH_SIZE ) {
108+ let stats = calculate_stats ( "special" , warp_stats) ;
109+ let total_batches = ( stats. len ( ) + UPDATE_BATCH_SIZE - 1 ) / UPDATE_BATCH_SIZE ;
110+ for ( i, batch) in stats. chunks ( UPDATE_BATCH_SIZE ) . enumerate ( ) {
111+ info ! ( "processing batch {} of {} for banner {}" , i + 1 , total_batches, "special" ) ;
108112 database:: warps_stats_global:: special:: set_bulk ( batch, pool) . await ?;
109113 }
110114
@@ -127,8 +131,10 @@ async fn lc(pool: &PgPool) -> Result<()> {
127131 return Ok ( ( ) ) ;
128132 }
129133
130- let stats = calculate_stats ( warp_stats) ;
131- for batch in stats. chunks ( UPDATE_BATCH_SIZE ) {
134+ let stats = calculate_stats ( "lc" , warp_stats) ;
135+ let total_batches = ( stats. len ( ) + UPDATE_BATCH_SIZE - 1 ) / UPDATE_BATCH_SIZE ;
136+ for ( i, batch) in stats. chunks ( UPDATE_BATCH_SIZE ) . enumerate ( ) {
137+ info ! ( "processing batch {} of {} for banner {}" , i + 1 , total_batches, "lc" ) ;
132138 database:: warps_stats_global:: lc:: set_bulk ( batch, pool) . await ?;
133139 }
134140
@@ -151,8 +157,10 @@ async fn collab(pool: &PgPool) -> Result<()> {
151157 return Ok ( ( ) ) ;
152158 }
153159
154- let stats = calculate_stats ( warp_stats) ;
155- for batch in stats. chunks ( UPDATE_BATCH_SIZE ) {
160+ let stats = calculate_stats ( "collab" , warp_stats) ;
161+ let total_batches = ( stats. len ( ) + UPDATE_BATCH_SIZE - 1 ) / UPDATE_BATCH_SIZE ;
162+ for ( i, batch) in stats. chunks ( UPDATE_BATCH_SIZE ) . enumerate ( ) {
163+ info ! ( "processing batch {} of {} for banner {}" , i + 1 , total_batches, "collab" ) ;
156164 database:: warps_stats_global:: collab:: set_bulk ( batch, pool) . await ?;
157165 }
158166
@@ -175,8 +183,10 @@ async fn collab_lc(pool: &PgPool) -> Result<()> {
175183 return Ok ( ( ) ) ;
176184 }
177185
178- let stats = calculate_stats ( warp_stats) ;
179- for batch in stats. chunks ( UPDATE_BATCH_SIZE ) {
186+ let stats = calculate_stats ( "collab lc" , warp_stats) ;
187+ let total_batches = ( stats. len ( ) + UPDATE_BATCH_SIZE - 1 ) / UPDATE_BATCH_SIZE ;
188+ for ( i, batch) in stats. chunks ( UPDATE_BATCH_SIZE ) . enumerate ( ) {
189+ info ! ( "processing batch {} of {} for banner {}" , i + 1 , total_batches, "collab lc" ) ;
180190 database:: warps_stats_global:: collab_lc:: set_bulk ( batch, pool) . await ?;
181191 }
182192
@@ -189,7 +199,8 @@ async fn collab_lc(pool: &PgPool) -> Result<()> {
189199 Ok ( ( ) )
190200}
191201
192- fn calculate_stats ( stats : Vec < database:: warps_stats:: DbWarpsStatCount > ) -> Vec < DbWarpsStatGlobal > {
202+ fn calculate_stats ( banner_type : & str , stats : Vec < database:: warps_stats:: DbWarpsStatCount > ) -> Vec < DbWarpsStatGlobal > {
203+ info ! ( "Calculating {} warp stats for banner: {}" , stats. len( ) , banner_type) ;
193204 let mut count_map = HashMap :: new ( ) ;
194205 let mut luck_4_map = HashMap :: new ( ) ;
195206 let mut luck_5_map = HashMap :: new ( ) ;
0 commit comments