Skip to content

replace own worker address by localhost and do not end gossip loop when peer connections fails#601

Closed
gaudenzkessler wants to merge 2 commits intomasterfrom
gk-dont-end-loop
Closed

replace own worker address by localhost and do not end gossip loop when peer connections fails#601
gaudenzkessler wants to merge 2 commits intomasterfrom
gk-dont-end-loop

Conversation

@gaudenzkessler
Copy link
Contributor

  • Replace in list of peers the own address of the worker itself by ws://localhost.
  • Do not end gossip block loop when the connecting to peer fails.

for p in peers.iter() {
// Todo: once the two direct servers are merged, remove this.
let url = worker_url_into_async_rpc_url(&p.url)?;
let url = match worker_url_into_async_rpc_url(&p.url) {
Copy link
Contributor

Choose a reason for hiding this comment

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

That will be made obsolete in PR #595 - but it will be easy to remove the conflict, so I don't mind.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this part in the gossiping loop has been made obsolete indeed, by more than one PR. So these changes here are not needed anymore.

Ok(())
}

/// Returns a list of peers. The address of the worker self is replaced by ws://localhost.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a note why this is necessary? Because for non-docker usage this doesn't make sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be of interest for me as well, because it explains why we have this second change in the PR 😄 (which seems to be not obvious for a number of people)

if e.url.trim_start_matches("ws://").trim_start_matches("wss://")
== self._config.worker_url()
{
e.url = format!("ws://localhost:{}", self._config.worker_rpc_port);
Copy link
Contributor

Choose a reason for hiding this comment

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

hm - hardcoded ws? Is it not possible to replace 127.0.0.1 or whatever ip with localhost , instead of replacing it fully?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @haerdib that this could and should be simplified. If a string contains our worker url, replace it with localhost:port. We don't have to care about the protocol (like ws:// or wss://) at all (and shouldn't). Also I'd like to see some unit tests 😈

@clangenb
Copy link
Contributor

Is this still needed after @haerdib changes?

@clangenb
Copy link
Contributor

Once again: @gaudenzkessler , @haerdib isn't this one obsolete?

@haerdib
Copy link
Contributor

haerdib commented Jan 25, 2022

I doubt that replace own worker address by localhost is obsolete now, if it was necessary before. I don't know about the rest.

@murerfel
Copy link
Contributor

It seems nobody knows what should happen with this PR? According to @gaudenzkessler , @clangenb should know - but that does not seem to be the case? Do we need to schedule a meeting and discuss this?

@gaudenzkessler
Copy link
Contributor Author

Lets discuss it quickly on the next daily. And if we cannot clarify, we will schedule another meeting.

Copy link
Contributor

@murerfel murerfel left a comment

Choose a reason for hiding this comment

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

I think we can completely drop the first part of changes in this PR, and improve on the implementation of the second part (url replacement with localhost) - as noted in the comments.

for p in peers.iter() {
// Todo: once the two direct servers are merged, remove this.
let url = worker_url_into_async_rpc_url(&p.url)?;
let url = match worker_url_into_async_rpc_url(&p.url) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this part in the gossiping loop has been made obsolete indeed, by more than one PR. So these changes here are not needed anymore.

Ok(())
}

/// Returns a list of peers. The address of the worker self is replaced by ws://localhost.
Copy link
Contributor

Choose a reason for hiding this comment

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

That would be of interest for me as well, because it explains why we have this second change in the PR 😄 (which seems to be not obvious for a number of people)

if e.url.trim_start_matches("ws://").trim_start_matches("wss://")
== self._config.worker_url()
{
e.url = format!("ws://localhost:{}", self._config.worker_rpc_port);
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @haerdib that this could and should be simplified. If a string contains our worker url, replace it with localhost:port. We don't have to care about the protocol (like ws:// or wss://) at all (and shouldn't). Also I'd like to see some unit tests 😈

@gaudenzkessler gaudenzkessler deleted the gk-dont-end-loop branch May 13, 2022 09:46
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.

5 participants