File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
chrome/settings/inbox/inbox-modules Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export class InboxListThreadsModule extends ViewModule<InboxView> {
20
20
if ( threads ?. length ) {
21
21
await promiseAllWithLimit (
22
22
10 ,
23
- threads . map ( t => this . renderInboxItem ( t . id ) )
23
+ threads . map ( t => ( ) => this . renderInboxItem ( t . id ) )
24
24
) ;
25
25
} else {
26
26
Xss . sanitizeRender ( '.threads' , `<p>No encrypted messages in ${ Xss . escape ( labelId ) } yet. ${ Ui . retryLink ( ) } </p>` ) ;
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ export class Gmail extends EmailProviderApi implements EmailProviderInterface {
138
138
public msgsGet = async ( msgIds : string [ ] , format : GmailResponseFormat ) : Promise < GmailRes . GmailMsg [ ] > => {
139
139
return await promiseAllWithLimit (
140
140
10 ,
141
- msgIds . map ( id => this . msgGet ( id , format ) )
141
+ msgIds . map ( id => ( ) => this . msgGet ( id , format ) )
142
142
) ;
143
143
} ;
144
144
Original file line number Diff line number Diff line change @@ -523,13 +523,14 @@ export const checkValidURL = (url: string): boolean => {
523
523
* Resolves when all promises are resolved or rejects when any promise is rejected.
524
524
*
525
525
* @param concurrency - The maximum number of promises to run at the same time.
526
- * @param tasks - An array of promises.
526
+ * @param tasks - An array of functions that return promises.
527
527
* @returns A Promise that resolves to an array of the resolved values of the input promises.
528
528
*/
529
- export const promiseAllWithLimit = async < V > ( concurrency : number , tasks : Promise < V > [ ] ) : Promise < V [ ] > => {
529
+ export const promiseAllWithLimit = async < V > ( concurrency : number , tasks : ( ( ) => Promise < V > ) [ ] ) : Promise < V [ ] > => {
530
530
let results : V [ ] = [ ] ;
531
531
while ( tasks . length ) {
532
- results = results . concat ( await Promise . all ( tasks . splice ( 0 , concurrency ) ) ) ;
532
+ const currentTasks = tasks . splice ( 0 , concurrency ) . map ( task => task ( ) ) ;
533
+ results = results . concat ( await Promise . all ( currentTasks ) ) ;
533
534
}
534
535
return results ;
535
536
} ;
You can’t perform that action at this time.
0 commit comments