Open ghaskins opened 7 months ago
Slack reference: https://temporalio.slack.com/archives/CTT84KXK9/p1700311804161219
To be consistent with existing APIs, my proposal is as follows:
class Async {
...
static Promise<Boolean> await(Duration timeout, Supplier<Boolean> unblockCondition);
}
An SDK function that works similarly to await but is based on promises rather than blocking could be useful to expand developer options for coordinating mixed event classes. For instance, coordinating an .all() on an invoked activity and receiving a signal.
This interface could be designed in several different ways. As an example:
This function would take a timeout and predicate, and return a promise. Temporal will evaluate the predicate on each state transition (similar to .await), and will resolve the promise with "true" if the predicate returns true. and "false" if the timeout expires.