Uncertainty about Idea Implementation
Ok, not sure if I am saying some silly and misunderstood the implementation or it is a valid idea.
Request/Resolved is internally baked by a Deferred and a listeners set.
When all "waiters" got interrupted, the internal deferred gets interrupted too (or listeners count goes back to zero).
Given all the above are true:
So that means that ideally we could have a "Request.interruptWhenNotNeededAnymore" (better names are welcome xD) that has signature as following:
Request.interruptWhenNotNeededAnymore(req: Request<E, A>): (fa: Effect<R, E2, A2>) => Effect<R, E2, void>
that is basically an internal race with the Request.Entry deferred and the fa.
This way if your resolver needs to do multiple different tasks, and some are request specific, it can safely interrupt those internally.
Request/Resolved is internally baked by a Deferred and a listeners set.
When all "waiters" got interrupted, the internal deferred gets interrupted too (or listeners count goes back to zero).
Given all the above are true:
So that means that ideally we could have a "Request.interruptWhenNotNeededAnymore" (better names are welcome xD) that has signature as following:
Request.interruptWhenNotNeededAnymore(req: Request<E, A>): (fa: Effect<R, E2, A2>) => Effect<R, E2, void>
that is basically an internal race with the Request.Entry deferred and the fa.
This way if your resolver needs to do multiple different tasks, and some are request specific, it can safely interrupt those internally.
