fix to batchSize

This commit is contained in:
Shlomi Noach 2017-02-12 18:09:54 +02:00
parent 88fc345c28
commit 80054b98db

View File

@ -1051,8 +1051,10 @@ func (this *Migrator) onApplyEventStruct(eventStruct *applyEventStruct) error {
availableEvents := len(this.applyEventsQueue)
batchSize := int(atomic.LoadInt64(&this.migrationContext.DMLBatchSize))
if availableEvents > batchSize {
availableEvents = batchSize
if availableEvents > batchSize-1 {
// The "- 1" is because we already consumed one event: the original event that led to this function getting called.
// So, if DMLBatchSize==1 we wish to not process any further events
availableEvents = batchSize - 1
}
for i := 0; i < availableEvents; i++ {
additionalStruct := <-this.applyEventsQueue