mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
Only check for custom nodes locally once
This commit is contained in:
parent
06c8ae6e5b
commit
895b959822
@ -71,7 +71,7 @@ class CustomNodeModal extends React.Component<Props, State> {
|
|||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.pollForDefaultNodes();
|
this.checkForDefaultNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: Props) {
|
public componentDidUpdate(prevProps: Props) {
|
||||||
@ -251,27 +251,22 @@ class CustomNodeModal extends React.Component<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private pollForDefaultNodes() {
|
private async checkForDefaultNodes() {
|
||||||
const pollingInterval = 3000;
|
const results = await exists(
|
||||||
this.timer = window.setInterval(async () => {
|
[
|
||||||
const results = await exists(
|
// tslint:disable-next-line:no-http-string
|
||||||
[
|
{ type: 'http', addr: 'http://localhost', port: 8545, timeout: 3000 }
|
||||||
// tslint:disable-next-line:no-http-string
|
],
|
||||||
{ type: 'http', addr: 'http://localhost', port: 8545, timeout: 3000 }
|
{ includeDefaults: false }
|
||||||
],
|
);
|
||||||
{ includeDefaults: false }
|
|
||||||
);
|
this.setState({
|
||||||
if (!this.timer) {
|
defaultNodes: results.filter(r => r.success).map((r, index) => ({
|
||||||
return;
|
...r,
|
||||||
}
|
display: `${r.addr}:${r.port}`,
|
||||||
this.setState({
|
index
|
||||||
defaultNodes: results.filter(r => r.success).map((r, index) => ({
|
}))
|
||||||
...r,
|
});
|
||||||
display: `${r.addr}:${r.port}`,
|
|
||||||
index
|
|
||||||
}))
|
|
||||||
});
|
|
||||||
}, pollingInterval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderDefaultNodeDropdown() {
|
private renderDefaultNodeDropdown() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user