Effectively Managing Concurrency in TypeScript
Hi all, I'm just starting and want to ask for more experienced folks what's the recommended approach for my use case:
I have a Typescript backend in nodejs with Express. Users call an endpoint, that has to make a call to a third provider in a service layer. My goal is to make this more resilient with Effect with retries and also limiting concurrency to 15, as It's the limit this external API has.
I'm having issues the part of limiting the concurrency, because each individual request can simply run
Do you have ideas for my use case? I wouldn't want to rewrite the entire endpoint, just make that API call more robust and with limited concurrency. Maybe sharing state across different Effects, is that a thing?
Anyway looking forward to your ideas! Hopefully this little experiment helps me learn more about Effect and start using It more and more, thank you!
I have a Typescript backend in nodejs with Express. Users call an endpoint, that has to make a call to a third provider in a service layer. My goal is to make this more resilient with Effect with retries and also limiting concurrency to 15, as It's the limit this external API has.
I'm having issues the part of limiting the concurrency, because each individual request can simply run
Effect.runPromise and It doesn't know anything about the other requests. I'm trying to hack together this concurrency validation in a level above Effect.runPromise but It doesn't look right.Do you have ideas for my use case? I wouldn't want to rewrite the entire endpoint, just make that API call more robust and with limited concurrency. Maybe sharing state across different Effects, is that a thing?
Anyway looking forward to your ideas! Hopefully this little experiment helps me learn more about Effect and start using It more and more, thank you!
