fix to batchSize
This commit is contained in:
parent
88fc345c28
commit
80054b98db
@ -1051,8 +1051,10 @@ func (this *Migrator) onApplyEventStruct(eventStruct *applyEventStruct) error {
|
|||||||
|
|
||||||
availableEvents := len(this.applyEventsQueue)
|
availableEvents := len(this.applyEventsQueue)
|
||||||
batchSize := int(atomic.LoadInt64(&this.migrationContext.DMLBatchSize))
|
batchSize := int(atomic.LoadInt64(&this.migrationContext.DMLBatchSize))
|
||||||
if availableEvents > batchSize {
|
if availableEvents > batchSize-1 {
|
||||||
availableEvents = batchSize
|
// 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++ {
|
for i := 0; i < availableEvents; i++ {
|
||||||
additionalStruct := <-this.applyEventsQueue
|
additionalStruct := <-this.applyEventsQueue
|
||||||
|
Loading…
Reference in New Issue
Block a user