Skip to content

[Not a Bug] await doesn't interrupts on the activity with error #399

Description

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

            foreach ($anticipationPromises as $promise) {
                $promise
                    ->then(function() use (&$index) {
                        $index++;
                        file_put_contents('/srv/app/ddd.log', time()." success $index\n", FILE_APPEND);
                    })
                    ->otherwise(function() use (&$index) {
                        $index++;
                        file_put_contents('/srv/app/ddd.log', time()." error $index\n", FILE_APPEND);
                    });
            }

            file_put_contents('/srv/app/ddd.log', time(). " start awaiting $index\n", FILE_APPEND);

            yield \Temporal\Workflow::awaitWithTimeout(
                 CarbonInterval::seconds(60),
                \React\Promise\all($anticipationPromises)
             );

            file_put_contents('/srv/app/ddd.log', time(). " complete $index\n", FILE_APPEND);

Result when 2 activities have no errors looks good

1708030014 start awaiting 0
1708030016 success 1
1708030018 success 2
1708030018 complete 2

Result when one of the activities has an error looks good (completion takes 60 seconds)

1708030094 start awaiting 0
1708030096 error 1
1708030098 success 2
1708030154 complete 2

Environment/Versions

  • temporal/sdk 2.7+

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    TestsUpdate tests or testing tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions