Skip to content

Possible error in usage of cancellationToken parameter to context.CreateTimer in AzureStorageScenarioTests.cs? #1178

Open
@erikbra

Description

Referring to

https://github.com/Azure/durabletask/blob/main/test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs#L3151, which is:

 Task timeoutTask = context.CreateTimer(deadline, cts.Token);

The second parameter of context.CreateTimer, that should be the state, not the cancellationToken, am I right? I'm trying to understand how to use this in my own projects, and looking at the source code to understand.

In this particular scenario, the state returned from the CreateTimer is not used, so it might not be easy to spot, but shouldn't the line be:

 object dummyState = new object() // whatever, the result is not used in this example
 Task timeoutTask = context.CreateTimer(deadline, dummyState, cts.Token);

where dummyState is the state? If not, the timer will never be cancelled, even when the approval task completes, and the orchestration instance will never finish?

Or have I misunderstood how this works?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions