Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.13
require (
github.com/golang/mock v1.4.3
github.com/lib/pq v1.3.0
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1
gopkg.in/yaml.v2 v2.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
13 changes: 11 additions & 2 deletions pg/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package pg
import (
"context"
"database/sql"
"fmt"
"time"

"github.com/pkg/errors"
"github.com/qor5/go-que"
)

Expand Down Expand Up @@ -124,8 +126,15 @@ func (j *job) RetryAfter(ctx context.Context, interval time.Duration, cerr error
intervalSeconds := interval.Seconds()
var errMsg, errStack string
if cerr != nil {
errMsg = cerr.Error()
errStack = que.Stack(4)
if _, ok := cerr.(interface {
StackTrace() errors.StackTrace
}); ok {
errStack = fmt.Sprintf("%+v", cerr)
} else {
// fallback
errMsg = cerr.Error()
errStack = que.Stack(4)
}
}
_, err := j.exec(j.tx)(ctx, retryJob, intervalSeconds, errMsg, errStack, j.id)
return err
Expand Down