-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Not a Bug] await doesn't interrupts on the activity with error #399
Labels
Tests
Update tests or testing tools
Comments
workarround with a counter and deferred promise could be used $index = 0;
$deferred = new Deferred();
$deferred->promise()
->then(function () use (&$index) {
file_put_contents('/srv/app/ddd.log', time() . " deferred resolved $index\n", FILE_APPEND);
});
foreach ($anticipationPromises as $promise) {
$promise
->then(function () use (&$index, $deferred) {
$index++;
file_put_contents('/srv/app/ddd.log', time() . " success $index\n", FILE_APPEND);
if ($index >= 2) {
$deferred->resolve(true);
}
})
->otherwise(function () use (&$index, $deferred) {
$index++;
file_put_contents('/srv/app/ddd.log', time() . " error $index\n", FILE_APPEND);
if ($index >= 2) {
$deferred->resolve(true);
}
});
}
file_put_contents('/srv/app/ddd.log', time() . " start awaiting $index\n", FILE_APPEND);
yield \Temporal\Workflow::awaitWithTimeout(
CarbonInterval::seconds(60),
$deferred->promise()
); And the result looks good
|
Seems not an issue, yield \Temporal\Workflow::awaitWithTimeout(
CarbonInterval::seconds(60),
\Temporal\Promise::all(array_map(
fn (ExtendedPromiseInterface $promise) => $promise->otherwise(fn () => false),
$promises
))
); |
I would like to keep this issue open for our records, so we can check the await behavior in combination with promise chaining. |
wolfy-j
added
Tests
Update tests or testing tools
and removed
Bug
Something isn't working
labels
Feb 16, 2024
wolfy-j
changed the title
[Bug] await doesn't interrupts on the activity with error
[Not a Bug] await doesn't interrupts on the activity with error
Aug 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are you really trying to do?
I want to use await function to ensure that activities are completed with or without an errors
Describe the bug
When any activity is completed with error, await function doesn't continue workflow immediately, it waits for the full interval
Minimal Reproduction
Result when 2 activities have no errors looks good
Result when one of the activities has an error looks good (completion takes 60 seconds)
Environment/Versions
Additional context
The text was updated successfully, but these errors were encountered: