Skip to content

Conversation

@Michal-Leszczynski
Copy link
Collaborator

There are 2 ways of disabling a task:

  • with 'sctool stop --disable' (or corresponding '/stop' API)
  • by updating task's 'enabled' property

It makes some sense that directly modyfing 'enabled' property does not result in stopping the task, but it makes no sense that stopping and disabling the task does not stop the task.

It can even be seen in the removed comment:
'// current task is canceled on save no need to stop it again', which is false, that this behavior is unintended.
We also execute our tests as if the code executed when calling '/stop' endpoint wasn't supposed to stop the task.

This commit fixes behavior of '/stop' endpoint to always stop the task and additionally disable it if requested. To improve readability and testing, I moved the logic of disabling the task to Scheduer.StopTask method, so that the API handler can just call it, and we can just test it.

Fixes #4736

There are 2 ways of disabling a task:
- with 'sctool stop --disable' (or corresponding '/stop' API)
- by updating task's 'enabled' property

It makes some sense that directly modyfing 'enabled'
property does not result in stopping the task, but it
makes no sense that stopping and disabling the task
does not stop the task.

It can even be seen in the removed comment:
'// current task is canceled on save no need to stop it again',
which is false, that this behavior is unintended.
We also execute our tests as if the code executed when calling
'/stop' endpoint wasn't supposed to stop the task.

This commit fixes behavior of '/stop' endpoint to always stop
the task and additionally disable it if requested. To improve
readability and testing, I moved the logic of disabling the
task to Scheduer.StopTask method, so that the API handler
can just call it, and we can just test it.

Fixes #4736
@Michal-Leszczynski Michal-Leszczynski marked this pull request as ready for review January 15, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stopped and disabled task is not stopped

2 participants