Skip to content

Commit

Permalink
refactor: absorb panics correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Aug 23, 2024
1 parent 97760e4 commit 0d22148
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils/worker/worker_temp.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ func (j *TaskPool) launchWorker(worker_id worker_types.WorkerID, tasks <-chan IT
task_err := make(chan error, 1)
go func() {
defer func() {
if !j.allow_failed_tasks {
return
}
if r := recover(); r != nil {
logus.Log.Error("Recovered in doRunf", typelog.Any("panic", r))
task_err <- errors.New(fmt.Sprintln("task paniced", r))
Expand Down

0 comments on commit 0d22148

Please sign in to comment.