From 66c1f86ade8a269e8cae1d3a3b575c73dd942b13 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Wed, 6 Dec 2023 16:00:23 +0000 Subject: [PATCH] Allow tasks to run concurrently --- src/Program.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Program.ts b/src/Program.ts index f505f03..37592ec 100644 --- a/src/Program.ts +++ b/src/Program.ts @@ -78,14 +78,17 @@ const processUser = (user: Users.User) => } yield* _( - Effect.forEach( - decisions, - Match.valueTags({ - AddReviewToProfile: decision => - Effect.logWarning('Need to add review').pipe(Effect.annotateLogs('doi', decision.doi)), - RemoveReviewFromProfile: decision => - Effect.logWarning('Need to remove review').pipe(Effect.annotateLogs('doi', decision.doi)), - }), + Effect.all( + ReadonlyArray.map( + decisions, + Match.valueTags({ + AddReviewToProfile: decision => + Effect.logWarning('Need to add review').pipe(Effect.annotateLogs('doi', decision.doi)), + RemoveReviewFromProfile: decision => + Effect.logWarning('Need to remove review').pipe(Effect.annotateLogs('doi', decision.doi)), + }), + ), + { concurrency: 'inherit' }, ), ) }).pipe(