Skip to content

Commit e75937d

Browse files
authored
Fix comparison to allow item buffers to be filled completely. (#54)
The comparison to buffer capacity should be `>`, not `>=`. The current comparison prevents the item buffers from ever being totally full, which implies that the final shard written from each buffer is smaller than the others by `sender_buffer_size`
1 parent 60412ad commit e75937d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,15 @@ impl<T, H: BufHandler<T>> BufferStateMachine<T, H> {
352352
let (mut new_state, outcome) = match current_state {
353353
FillAndWait(mut f, w) => {
354354
f.append(items);
355-
if f.len() + self.sender_buffer_size >= f.capacity() {
355+
if f.len() + self.sender_buffer_size > f.capacity() {
356356
(FillAndBusy(w), Process(f))
357357
} else {
358358
(FillAndWait(f, w), Done)
359359
}
360360
}
361361
FillAndBusy(mut f) => {
362362
f.append(items);
363-
if f.len() + self.sender_buffer_size >= f.capacity() {
363+
if f.len() + self.sender_buffer_size > f.capacity() {
364364
(BothBusy, Process(f))
365365
} else {
366366
(FillAndBusy(f), Done)

0 commit comments

Comments
 (0)