Azure / Azure/durabletask

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

Open
#1,178 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.7k
Forks
335
Avg merge
2d 23h
Merged PRs (30d)
6

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.