Skip to content

How to cancel async job that already running? #204

Answered by JohnRoesler
Aldiwildan77 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Aldiwildan77

Yes - you can stop the job by removing it. https://pkg.go.dev/github.com/go-co-op/gocron#Scheduler.Remove

As noted, you could also add a context to the job function to allow stopping the job if it's long running and you've removed it.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Aldiwildan77
Comment options

@Aldiwildan77
Comment options

@JohnRoesler
Comment options

Answer selected by Aldiwildan77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants