close
Skip to content

Attempt to concurrently connect to remote IP addresses#11757

Merged
Gargron merged 2 commits into
mastodon:masterfrom
ClearlyClaire:features/concurrent-connect
Sep 5, 2019
Merged

Attempt to concurrently connect to remote IP addresses#11757
Gargron merged 2 commits into
mastodon:masterfrom
ClearlyClaire:features/concurrent-connect

Conversation

@ClearlyClaire
Copy link
Copy Markdown
Contributor

Currently, Mastodon tries to connect one IP at a time, which means it will waste time if the first IP address it tries is unreachable.

Furthermore, it should address the following scenario:

  • instance A has two IP addresses
  • the first one is unreachable to instance B, the second is reachable to instance B
  • A issues a request to B, who needs to fetch a resource at A before replying
  • B timeouts on the first address, and thus can only reply after the timeout duration
  • which means A timeouts before allowing B to reply

@ClearlyClaire ClearlyClaire force-pushed the features/concurrent-connect branch 4 times, most recently from 3bc18e3 to 27114ab Compare September 4, 2019 15:57
Comment thread app/lib/request.rb Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not super happy about having a socket as a hash key, but I'm not sure how else to make the sockaddr corresponding to the socket when doing the IO.select bit. Should be fine in practice.

@ClearlyClaire ClearlyClaire force-pushed the features/concurrent-connect branch 2 times, most recently from 058aca8 to 2cf1c45 Compare September 4, 2019 16:22
@ClearlyClaire ClearlyClaire force-pushed the features/concurrent-connect branch from 2cf1c45 to 7b86633 Compare September 4, 2019 16:33
@Gargron Gargron merged commit 1653b58 into mastodon:master Sep 5, 2019
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
* Attempt to concurrently connect to remote IP addresses

* Reduce code length to please CodeClimate 🤷
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