Effect CommunityEC
Effect Community3y ago
13 replies
ex0ns

Difficulty Understanding Batching in Effect Library

After reading the docs (which is a great news btw, that was definitely lacking), I have a lot of trouble to understand how batching can work. In this case http://effect.website/docs/core-concepts/batching-caching#defining-queries and in particular in
const notifyOwner = (todo: Todo) => Effect.flatMap(
  getUserById(todo.ownerId),
  (user) => sendEmailToUser(user.id, `hey ${user.name} you got a todo!`)
)


Does this means that multiples calls to getUserById are "pooled" together before making the batch request, and then, for each of them, the continuation of the flatmap is applied ? How does this work ?
Was this page helpful?