Skip to content
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

swarm: remove unnecessary reqno for pending request tracking #2416

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Jul 9, 2023

First merge this to backoff cleanup and then we can merge both to master.

Opening small PRs for individual items since this piece is complicated

if !ok {
// some other dial for this request succeeded before this one
continue
for pr := range w.pendingRequests {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop will now be executed in random order. Is that ok?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue
}

for pr := range w.pendingRequests {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Assuming we have two go routines waiting.

  1. We don't actually guarantee ordered delivery. This just publishes to a channel. This channel is being read here. So the waiting go routines may be run in a different order.
  2. This doesn't block. The channel has 1 capacity, so both the waiters are notified immediately.

I don't know of any case where this might be an issue especially considering 1.

Also here we do provide an out of order delivery. In this case the first requester will be informed of the connection after the second requester(which added a valid address) was informed.

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this looks like a nice simplification. I don't think it resolves #2380 though.

@marten-seemann marten-seemann merged commit 87da2f1 into sukun/backoff-cleanup Jul 11, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants