be more conservative in increasing the window size, check that we actually had more messages

This commit is contained in:
vyzo 2020-08-28 23:09:48 +03:00
parent 3935fd77ac
commit 63a60cdd75

View File

@ -1485,12 +1485,13 @@ mainLoop:
return xerrors.Errorf("message processing failed: %w", err) return xerrors.Errorf("message processing failed: %w", err)
} }
} }
i -= batchSize
if i >= 0 { if i >= windowSize {
windowSize += 10 windowSize += 10
log.Infof("successfully fetched %d messages; increasing window size to %d", len(bstout), windowSize) log.Infof("successfully fetched %d messages; increasing window size to %d", len(bstout), windowSize)
} }
i -= batchSize
} }
// remember our window size // remember our window size