-
-
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
fix(bitswap.decision.Engine) send only the freshest messages #601
Conversation
close(oneTimeUse) | ||
return // ctx cancelled | ||
} | ||
oneTimeUse <- *envelope // buffered. won't block |
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.
personally, I would make the oneTimeUse
be a chan *Envelope
just to avoid a dereference, looks cleaner that way IMO
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.
Before, the engine worker would pop a task and block on send to the bitswap worker even if the bitswap worker wasn't to receive. Since the task could have been invalidated during this blocking send, a small number of stale (already acquired) blocks would be send to partners. Now, tasks are only popped off of the queue when bitswap is ready to send them over the wire. This is accomplished by removing the outboxChanBuffer and implementing a two-phase communication sequence.
8470698
to
5985854
Compare
This LGTM, but deferring to @whyrusleeping |
This LGTM too. |
…ness fix(bitswap.decision.Engine) send only the freshest messages
thanks guys |
* rt refresh refactor
Bitswap prioritizes sending of blocks using a PQ. A decision engine worker
pops tasks off the queue and gives bitswap packaged messages to be sent
to partners.
Before, the engine worker would pop a task and block on send to the
bitswap worker even if the bitswap worker wasn't to receive. Since the
task could have been invalidated during that blocking send, a small
number of stale (already acquired) blocks were sent to partners.
Now, tasks are only popped off of the queue when bitswap is ready to
send them over the wire. This is accomplished by removing the
outboxChanBuffer and implementing a two-phase communication sequence.