mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-08 07:25:51 +08:00
Compare commits
1 Commits
sohail/cha
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bf9204a82 |
@@ -7,9 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- `IsPanicError` function is added to support catching of panic errors when processing tasks (PR: https://github.com/hibiken/asynq/pull/491)
|
||||
|
||||
## [0.24.1] - 2023-05-01
|
||||
|
||||
### Changed
|
||||
|
||||
10
processor.go
10
processor.go
@@ -415,19 +415,21 @@ func (p *processor) queues() []string {
|
||||
func (p *processor) perform(ctx context.Context, task *Task) (err error) {
|
||||
defer func() {
|
||||
if x := recover(); x != nil {
|
||||
p.logger.Errorf("recovering from panic. See the stack trace below for details:\n%s", string(debug.Stack()))
|
||||
errMsg := string(debug.Stack())
|
||||
|
||||
p.logger.Errorf("recovering from panic. See the stack trace below for details:\n%s", errMsg)
|
||||
_, file, line, ok := runtime.Caller(1) // skip the first frame (panic itself)
|
||||
if ok && strings.Contains(file, "runtime/") {
|
||||
// The panic came from the runtime, most likely due to incorrect
|
||||
// map/slice usage. The parent frame should have the real trigger.
|
||||
_, file, line, ok = runtime.Caller(2)
|
||||
}
|
||||
var errMsg string
|
||||
|
||||
// Include the file and line number info in the error, if runtime.Caller returned ok.
|
||||
if ok {
|
||||
errMsg = fmt.Sprintf("panic [%s:%d]: %v", file, line, x)
|
||||
err = fmt.Errorf("panic [%s:%d]: %v", file, line, x)
|
||||
} else {
|
||||
errMsg = fmt.Sprintf("panic: %v", x)
|
||||
err = fmt.Errorf("panic: %v", x)
|
||||
}
|
||||
err = &errors.PanicError{
|
||||
ErrMsg: errMsg,
|
||||
|
||||
2
x/go.mod
2
x/go.mod
@@ -3,7 +3,7 @@ module github.com/hibiken/asynq/x
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/google/uuid v1.4.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/hibiken/asynq v0.24.1
|
||||
github.com/prometheus/client_golang v1.11.1
|
||||
github.com/redis/go-redis/v9 v9.3.0
|
||||
|
||||
4
x/go.sum
4
x/go.sum
@@ -51,8 +51,8 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hibiken/asynq v0.24.1 h1:+5iIEAyA9K/lcSPvx3qoPtsKJeKI5u9aOIvUmSsazEw=
|
||||
github.com/hibiken/asynq v0.24.1/go.mod h1:u5qVeSbrnfT+vtG5Mq8ZPzQu/BmCKMHvTGb91uy9Tts=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
|
||||
Reference in New Issue
Block a user