Skip to content

Commit

Permalink
Merge pull request #13 from Alethio/add-clientTimeout
Browse files Browse the repository at this point in the history
Add support for "clientTimeout" messages from the server
  • Loading branch information
baxy authored May 22, 2019
2 parents deb1b02 + 6f31155 commit 4b934ae
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 67 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.5.1] - 2019-05-22
- Add support for "clientTimeout" messages from the server

## [2.5.0] - 2019-05-21
- Add WebSocket API improvements
- Add support for "stats.pendingTxs"
Expand Down
2 changes: 1 addition & 1 deletion lib/Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class Logger {
}

if (processExit) {
process.exit();
process.exit((type === 'error' ? 1 : 0));
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default class Server {
this.socket.on('end', () => {
this.isLoggedIn = false;
this.socketIsOpen = false;
this.log.warning('Connection ended with ethstats server');
this.log.error('Connection ended with ethstats server', false, true);
});

this.socket.on('reconnect failed', () => {
Expand All @@ -167,6 +167,9 @@ export default class Server {
case 'invalidMessage':
this.resolveResponse(message.topic, message.payload);
break;
case 'clientTimeout':
this.resolveResponse(message.topic, message.payload);
break;
case 'requestRateLimitReached':
this.resolveResponse(message.topic, message.payload);
break;
Expand Down
8 changes: 4 additions & 4 deletions lib/app-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import moment from 'moment';

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

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

if (!process.argv.includes('-v')) {
Expand All @@ -48,7 +48,7 @@ const processOptions = {
pm2.connect(err => {
if (err) {
console.error(err);
process.exit(2);
process.exit(1);
}

if (daemonOption === 'start') {
Expand Down Expand Up @@ -95,7 +95,7 @@ pm2.connect(err => {
pm2.killDaemon(error => {
console.log(`Ethstats daemon KILL ${(error) ? chalk.red(`[FAILED] ${error.message}`) : chalk.green('[OK]')}`);
pm2.disconnect();
process.exit();
process.exit((error) ? 1 : 0);
});
}
});
Loading

0 comments on commit 4b934ae

Please sign in to comment.