Skip to content

Commit 4b934ae

Browse files
authored
Merge pull request #13 from Alethio/add-clientTimeout
Add support for "clientTimeout" messages from the server
2 parents deb1b02 + 6f31155 commit 4b934ae

6 files changed

Lines changed: 92 additions & 67 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [2.5.1] - 2019-05-22
5+
- Add support for "clientTimeout" messages from the server
6+
47
## [2.5.0] - 2019-05-21
58
- Add WebSocket API improvements
69
- Add support for "stats.pendingTxs"

lib/Logger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default class Logger {
3939
}
4040

4141
if (processExit) {
42-
process.exit();
42+
process.exit((type === 'error' ? 1 : 0));
4343
}
4444
}
4545

lib/Server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default class Server {
153153
this.socket.on('end', () => {
154154
this.isLoggedIn = false;
155155
this.socketIsOpen = false;
156-
this.log.warning('Connection ended with ethstats server');
156+
this.log.error('Connection ended with ethstats server', false, true);
157157
});
158158

159159
this.socket.on('reconnect failed', () => {
@@ -167,6 +167,9 @@ export default class Server {
167167
case 'invalidMessage':
168168
this.resolveResponse(message.topic, message.payload);
169169
break;
170+
case 'clientTimeout':
171+
this.resolveResponse(message.topic, message.payload);
172+
break;
170173
case 'requestRateLimitReached':
171174
this.resolveResponse(message.topic, message.payload);
172175
break;

lib/app-daemon.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import moment from 'moment';
55

66
if (config.configStore.get('firstRun') !== false) {
77
console.log('Your node is not registered. Please run "ethstats-cli" first.');
8-
process.exit();
8+
process.exit(1);
99
}
1010

1111
const daemonOption = process.argv[2];
@@ -27,7 +27,7 @@ if (!daemonAvailableOptions.includes(daemonOption)) {
2727
2828
If any CLI options are specified after the Daemon option, they will be forwarded to the forked process.
2929
`);
30-
process.exit();
30+
process.exit(1);
3131
}
3232

3333
if (!process.argv.includes('-v')) {
@@ -48,7 +48,7 @@ const processOptions = {
4848
pm2.connect(err => {
4949
if (err) {
5050
console.error(err);
51-
process.exit(2);
51+
process.exit(1);
5252
}
5353

5454
if (daemonOption === 'start') {
@@ -95,7 +95,7 @@ pm2.connect(err => {
9595
pm2.killDaemon(error => {
9696
console.log(`Ethstats daemon KILL ${(error) ? chalk.red(`[FAILED] ${error.message}`) : chalk.green('[OK]')}`);
9797
pm2.disconnect();
98-
process.exit();
98+
process.exit((error) ? 1 : 0);
9999
});
100100
}
101101
});

0 commit comments

Comments
 (0)