strvcom / strv-backend-go-background

Never lose your goroutine again.

Home Page:https://go.strv.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow cancellation of a task

CermakM opened this issue · comments

Is your feature request related to a problem? Please describe.
Currently, there is no way to control the execution of a long running task. The manager does not respect cancellation of the context of the task and it's not possible to kill the task from any of the lifecycle hooks.

While it's a valid argument that a task should continue it's execution if ran from the request of a context after that context has been cancelled, I believe some control is needed over that task.

Describe the solution you'd like
To be able to cancel a single task. I think a possible solution would be for the RunTask function to return a cancel func.