File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,15 +232,12 @@ export default class PaymasterWorker extends Worker {
232232
233233 let batch : WorkspaceDBScheme [ ] = [ ] ;
234234
235- const flush = async ( ) : Promise < void > => {
236- if ( batch . length === 0 ) {
235+ const flush = async ( currentBatch : WorkspaceDBScheme [ ] ) : Promise < void > => {
236+ if ( currentBatch . length === 0 ) {
237237 return ;
238238 }
239239
240- const current = batch ;
241-
242- batch = [ ] ;
243- await Promise . all ( current . map ( ( workspace ) => this . processWorkspaceSubscriptionCheck ( workspace ) ) ) ;
240+ await Promise . all ( currentBatch . map ( ( workspace ) => this . processWorkspaceSubscriptionCheck ( workspace ) ) ) ;
244241 } ;
245242
246243 try {
@@ -258,11 +255,12 @@ export default class PaymasterWorker extends Worker {
258255 batch . push ( workspace ) ;
259256
260257 if ( batch . length >= WORKSPACE_PROCESSING_CONCURRENCY ) {
261- await flush ( ) ;
258+ await flush ( batch ) ;
259+ batch = [ ] ;
262260 }
263261 }
264262
265- await flush ( ) ;
263+ await flush ( batch ) ;
266264 } finally {
267265 await cursor . close ( ) ;
268266 }
You can’t perform that action at this time.
0 commit comments