Skip to content

Commit

Permalink
check err inline
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCheung96 committed Jan 6, 2023
1 parent 26080e8 commit 1a4491c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cdc/processor/sourcemanager/engine/mounted_iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ func (i *MountedEventIter) Next(ctx context.Context) (event *model.PolymorphicEv
// There are no events in mounting. Fetch more events and mounting them.
// The batch size is determined by `maxBatchSize`.
if i.nextToEmit >= len(i.rawEvents) {
err = i.readBatch(ctx)
if err != nil {
if err = i.readBatch(ctx); err != nil {
return
}
}

// Check whether there are events in mounting or not.
if i.nextToEmit < len(i.rawEvents) {
idx := i.nextToEmit
if err = i.rawEvents[idx].event.WaitFinished(ctx); err == nil {
event = i.rawEvents[idx].event
txnFinished = i.rawEvents[idx].txnFinished
i.nextToEmit += 1
if err = i.rawEvents[idx].event.WaitFinished(ctx); err != nil {
return
}
event = i.rawEvents[idx].event
txnFinished = i.rawEvents[idx].txnFinished
i.nextToEmit += 1
}
return
}
Expand Down

0 comments on commit 1a4491c

Please sign in to comment.