-
Notifications
You must be signed in to change notification settings - Fork 112
fix: in message queue only send cancel if want was sent #345
Conversation
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.
I have some nits and comments, but they can be addressed later.
@@ -79,6 +87,7 @@ func (swl *SessionWantlist) Keys() []cid.Cid { | |||
return ks | |||
} | |||
|
|||
// All sessions that want the given keys |
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.
nit: Should be of the form:
SessionsFor returns all sessions that want the given keys.
(same for the others)
r.pending.RemoveType(c, wtype) | ||
} | ||
|
||
// Sent moves the want from the pending to the sent list | ||
func (r *recallWantlist) Sent(e bsmsg.Entry) { |
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.
Nit: MarkSent is the action.
// Called when the message has been successfully sent. | ||
onMessageSent := func(wantlist []bsmsg.Entry) { | ||
bcst := keysToSet(bcstEntries) | ||
prws := keysToSet(peerEntries) |
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.
This is probably going to show up on profiles, but we can wait and see.
mq.bcstWants.pending.Remove(e.Cid) | ||
mq.peerWants.pending.RemoveType(e.Cid, e.WantType) | ||
// Move the keys from pending to sent | ||
for _, e := range wantlist { |
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.
I assume we do it this way so we only move things that we actually sent? Given that, we might as well pre-compute that list instead of passing the wantlist back in.
fix: in message queue only send cancel if want was sent This commit was moved from ipfs/go-bitswap@6728add
No description provided.