Skip to content

Commit 57a155a

Browse files
committed
error-check the resume token persistence
1 parent 2b0a3f8 commit 57a155a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/verifier/change_stream.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ func (verifier *Verifier) iterateChangeStream(ctx context.Context, cs *mongo.Cha
122122
)
123123
}
124124

125+
if err == nil {
126+
err = persistResumeTokenIfNeeded()
127+
}
128+
125129
if err != nil {
126130
if !errors.Is(err, context.Canceled) {
127131
verifier.changeStreamErrChan <- err
@@ -130,8 +134,6 @@ func (verifier *Verifier) iterateChangeStream(ctx context.Context, cs *mongo.Cha
130134
return
131135
}
132136

133-
persistResumeTokenIfNeeded()
134-
135137
select {
136138
// If the changeStreamEnderChan has a message, the user has indicated that
137139
// source writes are ended. This means we should exit rather than continue

0 commit comments

Comments
 (0)