Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopiovanello committed Feb 7, 2025
1 parent 99069fe commit ce2fb13
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/subscription/task/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ func (t *CronTaskRunner) Spawner(ctx context.Context) {

// Stop a currently scheduled job
func (t *CronTaskRunner) StopTask(id string) error {
t.running[id].Done <- struct{}{}
delete(t.running, id)
task := t.running[id]
if task != nil {
t.running[id].Done <- struct{}{}
delete(t.running, id)
}
return nil
}

Expand Down

0 comments on commit ce2fb13

Please sign in to comment.