Skip to content

Commit

Permalink
Made empty batches not call handler
Browse files Browse the repository at this point in the history
  • Loading branch information
markdicksonjr committed Jul 5, 2019
1 parent 80a7452 commit d0b73eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (b *Batch) Flush() error {

// lock around batch processing
b.mutex.Lock()
if len(b.itemsToSave) > 0 {
if b.batchPosition > 0 {

// snag the rest of the buffer as a slice, reset buffer
subSlice := (b.itemsToSave)[0:b.batchPosition]
Expand Down
3 changes: 1 addition & 2 deletions functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func NewMutexFunction(
errFn(job.Context, err)
}),
}
s.dispatcher.Run()
return &s
}

Expand All @@ -47,4 +46,4 @@ func (m *MutexFunction) Call(data interface{}) error {

func (m *MutexFunction) WaitUntilIdle() {
m.dispatcher.WaitUntilIdle()
}
}

0 comments on commit d0b73eb

Please sign in to comment.