Skip to content

Commit 91bbdea

Browse files
authored
ADJUST: Reconnect after Server Restart (#2269)
* ADJUST: Reconnect after Server Restart * ADJUST: Logging * ADD: `--list-different` for prettier format check * REMOVE: `--list-different` * REMOVE: buildPrometheusJob * FIX: Format
1 parent 79babe2 commit 91bbdea

24 files changed

Lines changed: 12 additions & 102 deletions

launcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"stereum": "concurrently \"npm:electron:serve\" \"npm:watch:css\"",
2727
"backend:watch": "nodemon --watch 'src/backend' --exec 'npm run electron:serve'",
2828
"format": "prettier . --write",
29-
"format:check": "prettier . --check"
29+
"format:check": "prettier . --check"
3030
},
3131
"dependencies": {
3232
"@headlessui/vue": "^1.7.23",

launcher/src/backend/NodeConnection.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,10 +2111,10 @@ export class NodeConnection {
21112111
this.taskManager.otherTasksHandler(ref, "trigger restart", true);
21122112
await this.sshService.disconnect();
21132113
await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait for the disconnect to be fully done
2114-
const retry = { connected: false, counter: 0, maxTries: 300 };
2114+
const retry = { connected: false, counter: 0, maxTries: 60 };
21152115
log.info("Connecting via SSH");
21162116

2117-
while (!retry.connected && retry.counter < retry.maxTries) {
2117+
while (!retry.connected && retry.counter <= retry.maxTries) {
21182118
try {
21192119
retry.counter++;
21202120
log.info(`Trying to connect (${retry.counter})`);
@@ -2131,10 +2131,11 @@ export class NodeConnection {
21312131
true,
21322132
err + "\n\n" + (retry.maxTries - retry.counter) + " tries left."
21332133
);
2134-
log.info(" Could not connect.\n" + (retry.maxTries - retry.counter) + " tries left.");
2134+
log.info("Could not connect. " + (retry.maxTries - retry.counter) + " tries left.");
2135+
await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait 5 seconds before retrying
21352136
}
21362137
}
2137-
log.info("OUT OF WHILE LOOP");
2138+
21382139
if (retry.connected) {
21392140
await this.establish(this.taskManager);
21402141
this.taskManager.otherTasksHandler(ref, "Connected", true);

launcher/src/backend/ethereum-services/BesuService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ export class BesuService extends NodeService {
8080
return "stereum-" + this.id + ":9545";
8181
}
8282

83-
buildPrometheusJob() {
84-
return `\n - job_name: stereum-${this.id}\n static_configs:\n - targets: [${this.buildExecutionClientMetricsEndpoint()}]`;
85-
}
86-
8783
getDataDir() {
8884
return this.volumes.find((volume) => volume.servicePath === "/opt/app/data")?.destinationPath;
8985
}

launcher/src/backend/ethereum-services/ErigonService.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ export class ErigonService extends NodeService {
8787
return "stereum-" + this.id + ":6060";
8888
}
8989

90-
buildPrometheusJob() {
91-
return `\n - job_name: stereum-${
92-
this.id
93-
}\n metrics_path: /debug/metrics/prometheus\n static_configs:\n - targets: [${this.buildExecutionClientMetricsEndpoint()}]`;
94-
}
95-
9690
getDataDir() {
9791
return this.volumes.find((volume) => volume.servicePath === "/opt/data/erigon")?.destinationPath;
9892
}

launcher/src/backend/ethereum-services/GethService.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ export class GethService extends NodeService {
9797
return "stereum-" + this.id + ":6060";
9898
}
9999

100-
buildPrometheusJob() {
101-
return `\n - job_name: stereum-${
102-
this.id
103-
}\n metrics_path: /debug/metrics/prometheus\n static_configs:\n - targets: [${this.buildExecutionClientMetricsEndpoint()}]`;
104-
}
105-
106100
getDataDir() {
107101
return this.volumes.find((volume) => volume.servicePath === "/opt/data/geth")?.destinationPath;
108102
}

launcher/src/backend/ethereum-services/GrandineBeaconService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ export class GrandineBeaconService extends NodeService {
103103
return "stereum-" + this.id + ":5054";
104104
}
105105

106-
buildPrometheusJob() {
107-
return `\n - job_name: stereum-${this.id}\n static_configs:\n - targets: [${this.buildConsensusClientMetricsEndpoint()}]`;
108-
}
109-
110106
getDataDir() {
111107
return this.volumes.find((volume) => volume.servicePath === "/opt/app/data")?.destinationPath;
112108
}

launcher/src/backend/ethereum-services/LighthouseBeaconService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ export class LighthouseBeaconService extends NodeService {
107107
return "stereum-" + this.id + ":5054";
108108
}
109109

110-
buildPrometheusJob() {
111-
return `\n - job_name: stereum-${this.id}\n static_configs:\n - targets: [${this.buildConsensusClientMetricsEndpoint()}]`;
112-
}
113-
114110
getDataDir() {
115111
return this.volumes.find((volume) => volume.servicePath === "/opt/app/beacon")?.destinationPath;
116112
}

launcher/src/backend/ethereum-services/LodestarBeaconService.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ export class LodestarBeaconService extends NodeService {
9999
return "stereum-" + this.id + ":8008";
100100
}
101101

102-
buildPrometheusJob() {
103-
return `\n - job_name: stereum-${
104-
this.id
105-
}\n metrics_path: /metrics\n static_configs:\n - targets: [${this.buildConsensusClientMetricsEndpoint()}]`;
106-
}
107-
108102
getDataDir() {
109103
return this.volumes.find((volume) => volume.servicePath === "/opt/app/beacon")?.destinationPath;
110104
}

launcher/src/backend/ethereum-services/NethermindService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ export class NethermindService extends NodeService {
8080
return "stereum-" + this.id + ":6060";
8181
}
8282

83-
buildPrometheusJob() {
84-
return `\n - job_name: stereum-${this.id}\n static_configs:\n - targets: [${this.buildExecutionClientMetricsEndpoint()}]`;
85-
}
86-
8783
getDataDir() {
8884
return this.volumes.find((volume) => volume.servicePath === "/opt/app/data")?.destinationPath;
8985
}

launcher/src/backend/ethereum-services/NimbusBeaconService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ export class NimbusBeaconService extends NodeService {
9494
return "stereum-" + this.id + ":8008";
9595
}
9696

97-
buildPrometheusJob() {
98-
return `\n - job_name: "nimbus"\n metrics_path: /metrics\n static_configs:\n - targets: [${this.buildConsensusClientMetricsEndpoint()}]`;
99-
}
100-
10197
getDataDir() {
10298
return this.volumes.find((volume) => volume.servicePath === "/opt/app/beacon")?.destinationPath;
10399
}

0 commit comments

Comments
 (0)