Skip to content

Commit

Permalink
fix: batch write race on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
corverroos committed Aug 19, 2024
1 parent b0d383c commit 1246525
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 1246525

Please sign in to comment.