diff --git a/batch.go b/batch.go index 0bad0ea..75d818d 100644 --- a/batch.go +++ b/batch.go @@ -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] diff --git a/functions.go b/functions.go index 2c860ad..82947e3 100644 --- a/functions.go +++ b/functions.go @@ -34,7 +34,6 @@ func NewMutexFunction( errFn(job.Context, err) }), } - s.dispatcher.Run() return &s } @@ -47,4 +46,4 @@ func (m *MutexFunction) Call(data interface{}) error { func (m *MutexFunction) WaitUntilIdle() { m.dispatcher.WaitUntilIdle() -} \ No newline at end of file +}