Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from Alethio/v1.3.10
Browse files Browse the repository at this point in the history
v1.3.10
  • Loading branch information
baxy authored Feb 15, 2019
2 parents 57d6532 + e5d82e5 commit ed07c70
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 81 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.3.10] - 2019-02-15
- Fixed bug when Deepstream is restoring data on crash/restart
- Added server urls testnets Rinkeby and Goerli

## [1.3.9] - 2019-02-07
- Update docker compose to use custom nginx config

Expand Down
16 changes: 13 additions & 3 deletions app/lib/DsDataLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class DsDataLoader {
this.result = diContainer.result;
}

initNodeCount() {
initNodeCount(params) {
let dsNodeCountId = `${this.appConfig.DEEPSTREAM_NAMESPACE}/stats/nodeCountData`;

let statsList = this.deepstream.record.getList(`${this.appConfig.DEEPSTREAM_NAMESPACE}/stats`);
Expand All @@ -19,7 +19,17 @@ export default class DsDataLoader {
}
});

this.setRecord(dsNodeCountId, 'nodeCountData', {active: 0});
if (params.resetDsData) {
this.setRecord(dsNodeCountId, 'nodeCountData', {active: 0});
} else {
this.models.Nodes.getAllActive().then(result => {
if (result.rowLength > 0) {
this.setRecord(`${this.appConfig.DEEPSTREAM_NAMESPACE}/stats/nodeCountData`, 'nodeCountData', {
active: result.rowLength
});
}
});
}
}

initLastBlock() {
Expand Down Expand Up @@ -50,7 +60,7 @@ export default class DsDataLoader {

if (data && data.rowLength > 0) {
for (let i = 0; i < data.rowLength; i++) {
if (params.initDsNodesAsInactive) {
if (params.resetDsData) {
data.rows[i].isActive = false;
}

Expand Down
14 changes: 8 additions & 6 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import controllers from './controllers/server/index.js';

export default class Server {
constructor(diContainer) {
this.initDsNodesAsInactive = true;
this.resetDsData = true;
this.appConfig = diContainer.appConfig;
this.log = diContainer.logger;
this.lodash = diContainer.lodash;
Expand Down Expand Up @@ -92,8 +92,10 @@ export default class Server {
this.deepstream.on('connectionStateChanged', state => {
if (state === 'OPEN') {
this.log.info(`Deepstream => Connected to: ${this.deepstreamConfig.host}:${this.deepstreamConfig.port}`);
this.log.info('Deepstream => Restoring data');
this.initDeepstreamData();
setTimeout(() => {
this.log.info('Deepstream => Restoring data');
this.initDeepstreamData();
}, 500);
}
});
this.deepstream.on('error', error => {
Expand Down Expand Up @@ -321,11 +323,11 @@ export default class Server {
}

initDeepstreamData() {
this.dsDataLoader.initNodeCount();
this.dsDataLoader.initNodeCount({resetDsData: this.resetDsData});
this.dsDataLoader.initLastBlock();
this.dsDataLoader.initNodes({initDsNodesAsInactive: this.initDsNodesAsInactive});
this.dsDataLoader.initNodes({resetDsData: this.resetDsData});

this.initDsNodesAsInactive = false;
this.resetDsData = false;

this.models.Blocks.getLastBlockNumber().then(lastBlockNumber => {
if (lastBlockNumber !== null) {
Expand Down
14 changes: 9 additions & 5 deletions config/ClientConfigs.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ const clientConfigs = {
mainnet: {
networkName: 'mainnet',
url: `https://server.net.${ETHSTATS_DOMAIN}:443`
}/* ,
},
rinkeby: {
networkName: 'rinkeby',
url: `https://server.net.rinkeby.${ETHSTATS_DOMAIN}:443`
},
goerli: {
networkName: 'goerli',
url: `https://server.net.goerli.${ETHSTATS_DOMAIN}:443`
}/*,
ropsten: {
networkName: 'ropsten',
url: `https://server.net.ropsten.${ETHSTATS_DOMAIN}:443`
},
kovan: {
networkName: 'kovan',
url: `https://server.net.kovan.${ETHSTATS_DOMAIN}:443`
},
rinkeby: {
networkName: 'rinkeby',
url: `https://server.net.rinkeby.${ETHSTATS_DOMAIN}:443`
}*/
},
dashboardUrl: `https://net.${ETHSTATS_DOMAIN}`,
Expand Down
136 changes: 70 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethstats-network-server",
"version": "1.3.9",
"version": "1.3.10",
"description": "EthStats - Network Monitor - Server (net.ethstats.io)",
"homepage": "https://github.com/Alethio/ethstats-network-server",
"license": "MIT",
Expand Down

0 comments on commit ed07c70

Please sign in to comment.