Await result of Uni X for the duration of the execution of Uni Y #1344
Closed
technical-debt-collector
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Mutiny is not doing the work of a scheduler. That being said you may explore a combination of:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have an API in which we schedule several unis to execute simultaneously.
Some of these operations can may spend unacceptable durations in our API. In such cases we'd rather ignore their results than wait for them (these occasionally slow operations are unnecessary to the API operation itself, but allows for fail-fast and synchronous rejections whenever they execute fast enough).
Currently, we've solved this by chaining
ifNoItem().after(SOME_DURATION).recoverWithUni(SOME_RESOLUTION)
, but this forces us to assign a fixed duration which is not ideal.I have looked through existing discussions but haven't really found anything relevant, so I propose adding the functionality to execute a Uni X for as long as the execution duration of uni Y, resolving (or failing) the execution of X with something predefined whenever Y completes first.
This way we'd be able to spend the maximum time possible waiting for a result without ever incurring prolonged response times in our API (hopefully).
Beta Was this translation helpful? Give feedback.
All reactions