Skip to content

Commit

Permalink
fix: batch write race on commit (backport #983) (#992)
Browse files Browse the repository at this point in the history
Co-authored-by: corver <[email protected]>
  • Loading branch information
mergify[bot] and corverroos authored Sep 23, 2024
1 parent 6175441 commit 34895bf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion import.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,17 @@ func (i *Importer) Commit() error {
len(i.stack))
}

err := i.batch.WriteSync()
// Wait for previous batch.
var err error
if i.inflightCommit != nil {
err = <-i.inflightCommit
i.inflightCommit = nil
}
if err != nil {
return err
}

err = i.batch.WriteSync()
if err != nil {
return err
}
Expand Down

0 comments on commit 34895bf

Please sign in to comment.