Skip to content

Commit d070309

Browse files
MB-55637: Adapting signature of scorch's async onError callback (#1800)
+ This change in signature is necessary to introduce some more context in the user application to associate the scorch index with the error.
1 parent ebf9a6d commit d070309

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index/scorch/event.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import "time"
1818

1919
// RegistryAsyncErrorCallbacks should be treated as read-only after
2020
// process init()'ialization.
21-
var RegistryAsyncErrorCallbacks = map[string]func(error){}
21+
var RegistryAsyncErrorCallbacks = map[string]func(error, string){}
2222

2323
// RegistryEventCallbacks should be treated as read-only after
2424
// process init()'ialization.

index/scorch/scorch.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type Scorch struct {
7070
asyncTasks sync.WaitGroup
7171

7272
onEvent func(event Event)
73-
onAsyncError func(err error)
73+
onAsyncError func(err error, path string)
7474

7575
forceMergeRequestCh chan *mergerCtrl
7676

@@ -185,7 +185,7 @@ func (s *Scorch) fireEvent(kind EventKind, dur time.Duration) {
185185

186186
func (s *Scorch) fireAsyncError(err error) {
187187
if s.onAsyncError != nil {
188-
s.onAsyncError(err)
188+
s.onAsyncError(err, s.path)
189189
}
190190
atomic.AddUint64(&s.stats.TotOnErrors, 1)
191191
}

0 commit comments

Comments
 (0)