Skip to content

Promise combinators with concurrent waits do not resolve properly #265

@anthonyting

Description

@anthonyting
const handler = withDurableExecution(
  async (_event: unknown, context: DurableContext) => {
    await context.promise.race([
      context.wait({ seconds: 1 }),
      context.wait({ seconds: 10 }),
    ]);
  },
);

This should only take 1 second and complete the execution, but it runs both waits and takes 11 seconds.

Similarly, this should instantly return but it actually waits 10 seconds:

const handler = withDurableExecution(
  async (_event: unknown, context: DurableContext) => {
    await context.promise.race([
      context.step(() => Promise.resolve("quick resolve")),
      context.wait({ seconds: 10 }),
    ]);
  },
);

The same could apply to map/parallel

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglanguage-sdkIssue relates to the Language SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions