You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's better that each iterator's NextWithContext returns early if the
given context is already canceled. Otherwise, they try to unmarshal an
item if iter.output has a response or send an unnecessary request to
the DB.
It can be the caller's responsibility to avoid calling NextWithContext
after the context gets canceled. However, it requires this kind of
context check in every loop:
```
for ctx.Err() != nil && iter.NextWithContext(ctx, &out){
...
}
if ctx.Err() != nil { return ctx.Err() }
```
If NextWithContext does it instead of the caller, we can avoid
such duplicated code.
0 commit comments