Skip to content

Commit

Permalink
autobatch: don't forget to flush on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Apr 13, 2019
1 parent f0357db commit 534082e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autobatch/autobatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func NewAutoBatching(d ds.Batching, size int) *Datastore {
// Delete deletes a key/value
func (d *Datastore) Delete(k ds.Key) error {
d.buffer[k] = op{delete: true}
if len(d.buffer) > d.maxBufferEntries {
return d.Flush()
}
return nil
}

Expand Down

0 comments on commit 534082e

Please sign in to comment.