Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

feat: Try relaunching parity-ethereum node if it's not connecting after 15s#543

Merged
amaury1093 merged 11 commits intomasterfrom
am-kill-node
Sep 3, 2019
Merged

feat: Try relaunching parity-ethereum node if it's not connecting after 15s#543
amaury1093 merged 11 commits intomasterfrom
am-kill-node

Conversation

@amaury1093
Copy link
Collaborator

fixes #538

Repro:

  • launch a light client in a terminal
  • launch fether
  • kill the node in the terminal: fether should say "connecting to node..."
  • wait 15s
  • fether should re-appear

Additional cleanup:

  • Removed all the <RequireHealthOverlay require='node'> in the code (mostly in Accounts pages), and put one single <RequireHealthOverlay require='node'> in App.js. This is because App.js is wrapped in <RequireParityVersion>, which itself actually already requires <RequireHealthOverlay require='node'> (or else we have a blank screen, aka what ToB saw in their report)
  • In health status, removed status.launching. At the beginning it was used to denote if parity-ethereum is in the process of launching, i.e. not api not connected yet, but process is launched. Not very useful.

@axelchalon axelchalon self-requested a review August 30, 2019 13:09
break;
}
case 'RESTART_NODE_REQUEST': {
setupParityEthereum({});
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, if hasCalledInitParityEthereum was actually set to true where it should have been in the code, this would have thrown Unable to initialise Parity Ethereum more than once :P

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, setupParityEthereum takes a parameter and passes down .win to ParityEthereum, but the ParityEthereum constructor doesn't take any argument; let's fix this while we're at it.

Copy link
Contributor

@axelchalon axelchalon Aug 30, 2019

Choose a reason for hiding this comment

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

Well, if hasCalledInitParityEthereum was actually set to true where it should have been in the code, this would have thrown Unable to initialise Parity Ethereum more than once :p

We could for example:

  • have the current constructor logic of ParityEthereum inside (new ParityEthereum).init()
  • store ParityEthereum in FetherApp
  • use fetherApp.parityEthereum.init() in the message handler

or not have ParityEthereum be a class...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

or not have ParityEthereum be a class...

lol, that's what I wanted to find somewhere in the code, but everything seems to be a class.

I just did as if setupParityEthereum was that function, didn't think too much about it. I propose just to remove the argument of this function, and not refactor too much (leave it for a next PR refactor PR). What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

The return value of setupParityEthereum (the instance of ParityEthereum) isn't used anywhere, and ParityEthereum is only used by setupParityEthereum. So I think it's safe to move the code of the constructor of ParityEthereum (minus hasCalledInitParityEthereum) as the contents of setupParityEthereum. I don't think it's too much work, but I don't mind if we do this in another PR

Copy link
Contributor

@axelchalon axelchalon left a comment

Choose a reason for hiding this comment

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

Works, code grumbles

Copy link
Contributor

@axelchalon axelchalon left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

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

Works well!

@amaury1093 amaury1093 merged commit 7cdce3b into master Sep 3, 2019
@amaury1093 amaury1093 deleted the am-kill-node branch September 3, 2019 08:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infinit waiting if the node is killed

3 participants