Skip to content

Commit

Permalink
fix: batch write race on commit (#983)
Browse files Browse the repository at this point in the history
(cherry picked from commit fe80f0a)
  • Loading branch information
corverroos authored and mergify[bot] committed Sep 23, 2024
1 parent 9d5d280 commit 05fd70e
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 05fd70e

Please sign in to comment.