Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow InfluxService to be registered without 'initial ping' #1468

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/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 api/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "explorer-api",
"description": "API for Tangle Explorer",
"version": "3.3.10-rc.1",
"version": "3.3.10-rc.2",
"author": "Martyn Janes <[email protected]>",
"repository": {
"type": "git",
Expand Down
28 changes: 6 additions & 22 deletions api/src/services/stardust/influx/influxDbClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { INanoDate, InfluxDB, IPingStats, IResults, toNanoDate } from "influx";
import { INanoDate, InfluxDB, IResults, toNanoDate } from "influx";
import moment from "moment";
import cron from "node-cron";
import {
Expand Down Expand Up @@ -134,7 +134,7 @@ export abstract class InfluxDbClient {

/**
* Build a new client instance asynchronously.
* @returns Boolean representing that the client ping succeeded.
* @returns Boolean representing that the client was initialised.
*/
public async buildClient(): Promise<boolean> {
const protocol = this._network.analyticsInfluxDbProtocol || "https";
Expand All @@ -157,27 +157,11 @@ export abstract class InfluxDbClient {

const influxDbClient = new InfluxDB({ protocol, port, host, database, username, password, options });

return influxDbClient
.ping(1500)
.then((pingResults: IPingStats[]) => {
if (pingResults.length > 0) {
const anyHostIsOnline = pingResults.some((ping) => ping.online);
this._client = influxDbClient;
this.setupDataCollection();
logger.info(`[InfluxDb] Client started for "${network}"...`);

if (anyHostIsOnline) {
logger.info(`[InfluxDb] Client started for "${network}"...`);
this._client = influxDbClient;
this.setupDataCollection();
}

return anyHostIsOnline;
}

return false;
})
.catch((e) => {
logger.verbose(`[InfluxDb] Ping failed for "${network}". ${e}`);
return false;
});
return true;
}

logger.warn(`[InfluxDb] Configuration not found for "${network}".`);
Expand Down
4 changes: 2 additions & 2 deletions client/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 client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "explorer-client",
"description": "Tangle Explorer UI",
"version": "3.3.10-rc.1",
"version": "3.3.10-rc.2",
"author": "Martyn Janes <[email protected]>",
"type": "module",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "explorer",
"description": "Tangle Explorer",
"version": "3.3.10-rc.1",
"version": "3.3.10-rc.2",
"scripts": {
"setup:client": "cd client && npm install && npm run postinstall",
"setup:api": "cd api && npm install && npm run build-compile && npm run build-config",
Expand Down
Loading