-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use NextSync method in Datastore #3386
Conversation
4970133
to
844b425
Compare
@@ -186,8 +186,9 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error) | |||
select { | |||
case <-ctx.Done(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we're checking the context at the send layer (and this is in a goroutine, and not expected to really block) we can do away with the select and context check entirely here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so just use something like:
e, ok := res.NextSync()
if !ok { return nil, false }
...
Note: Edited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a for loop there either i think
License: MIT Signed-off-by: Kevin Atkinson <[email protected]>
844b425
to
24aa42d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
License: MIT Signed-off-by: Kevin Atkinson <[email protected]>
See ipfs/go-datastore#53 ipfs/go-datastore#54