Skip to content

Commit

Permalink
MB-55637: Adapting signature of scorch's async onError callback (#1800)
Browse files Browse the repository at this point in the history
+ This change in signature is necessary to introduce some
  more context in the user application to associate the
  scorch index with the error.
  • Loading branch information
abhinavdangeti authored Mar 17, 2023
1 parent ebf9a6d commit d070309
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index/scorch/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import "time"

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

// RegistryEventCallbacks should be treated as read-only after
// process init()'ialization.
Expand Down
4 changes: 2 additions & 2 deletions index/scorch/scorch.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Scorch struct {
asyncTasks sync.WaitGroup

onEvent func(event Event)
onAsyncError func(err error)
onAsyncError func(err error, path string)

forceMergeRequestCh chan *mergerCtrl

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

func (s *Scorch) fireAsyncError(err error) {
if s.onAsyncError != nil {
s.onAsyncError(err)
s.onAsyncError(err, s.path)
}
atomic.AddUint64(&s.stats.TotOnErrors, 1)
}
Expand Down

0 comments on commit d070309

Please sign in to comment.