accounting: add call to clear stats

- Make calls more consistent by changing path to kebab case.
- Add stacktrace information to job panics
This commit is contained in:
Aleksandar Jankovic
2019-08-02 16:56:19 +01:00
committed by Nick Craig-Wood
parent 5be968c0ca
commit 6a3e301303
4 changed files with 56 additions and 4 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ package jobs
import (
"context"
"fmt"
"runtime/debug"
"sync"
"sync/atomic"
"time"
@@ -126,7 +127,7 @@ func (job *Job) finish(out rc.Params, err error) {
func (job *Job) run(ctx context.Context, fn rc.Func, in rc.Params) {
defer func() {
if r := recover(); r != nil {
job.finish(nil, errors.Errorf("panic received: %v", r))
job.finish(nil, errors.Errorf("panic received: %v \n%s", r, string(debug.Stack())))
}
}()
job.finish(fn(ctx, in))