Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions writers/batchwriter/batchwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ func (w *BatchWriter) worker(ctx context.Context, tableName string, ch <-chan *m
limit.AddSlice(add)
}
if len(toFlush) > 0 || rest != nil || limit.ReachedLimit() {
// flush current batch
send()
if limit.Rows() > 0 {
send()
}
Comment thread
bbernays marked this conversation as resolved.
ticker.Reset(w.batchTimeout)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go inside the if as well?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or have batch.SliceRecord return toFlush = 0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to reset the batchTimeout even if there were no resources to ensure that we don't just sync a single row the next time

}
for _, sliceToFlush := range toFlush {
Expand Down
Loading