danielgerlag / danielgerlag/workflow-core
CancelConditon on Schedule seems to be ignored
- Dominant language
- C#
- Stars
- 5.9k
- Forks
- 1.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 5
Description
**Describe the bug**
When I add a cancel condition to a Schedule, when the cancelation condition is true it still seems to run the schedule.
**To Reproduce**
I have modified WorkflowCore.Sample16 to make sure I had a clean example.
`
builder
.StartWith(context => Console.WriteLine("Hello"))
.Schedule(data => TimeSpan.FromSeconds(5)).Do(schedule => schedule
.StartWith(context => Console.WriteLine("Doing scheduled tasks"))
)
.CancelCondition(s => true, true)
.Then(context => Console.WriteLine("Doing normal tasks"));
`
Basically I have added the `.CancelCondition(s => true, true)` to the Schedule to force it to always be cancelled but the output is still showing "Doing scheduled tasks" after 5 seconds has passed.
**Expected behavior**
I would expect the schedule to cancel and not write "Doing scheduled tasks" to the console.
**Additional context**
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the modified WorkflowCore.Sample16 reproduction shown in the issue and run it to confirm that a Schedule with an always-true CancelCondition still executes. Trace the Schedule cancellation path; done means the scheduled task is not run when the condition is true, while the normal continuation behaves as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100