Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
 Conflicts:
	api/src/services/stardust/influx/influxServiceStardust.ts
  • Loading branch information
msarcev committed May 8, 2024
2 parents d3b4008 + 0289727 commit 444c433
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 33 deletions.
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
36 changes: 10 additions & 26 deletions api/src/services/influx/influxClient.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 logger from "../../logger";
import { INetwork } from "../../models/db/INetwork";
Expand Down Expand Up @@ -46,7 +46,7 @@ export abstract class InfluxDbClient {
const password = this._network.analyticsInfluxDbPassword;

if (host && database && username && password) {
logger.verbose(`[InfluxClient Found configuration for (${network})]`);
logger.verbose(`[InfluxClient] Found configuration for (${network})]`);
const token = Buffer.from(`${username}:${password}`, "utf8").toString("base64");
const options = {
headers: {
Expand All @@ -56,30 +56,14 @@ 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(`[InfluxClient] Client started for "${network}"...`);

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

return anyHostIsOnline;
}

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

logger.warn(`[InfluxClient Configuration not found for "${network}".`);
logger.warn(`[InfluxClient] Configuration not found for "${network}".`);
return false;
}

Expand All @@ -104,7 +88,7 @@ export abstract class InfluxDbClient {

if (debug) {
logger.debug(
`[InfluxClient Refreshing ${description} from date
`[InfluxClient] Refreshing ${description} from date
${fromNanoDate ? fromNanoDate.toISOString() : null} (${this._network.network})`,
);
}
Expand All @@ -117,7 +101,7 @@ export abstract class InfluxDbClient {
if (this.isAnyFieldNotNull<T>(update)) {
if (debug) {
logger.debug(
`[InfluxClient Setting ${description} cache entry (${network}): ${moment(update.time).format(
`[InfluxClient] Setting ${description} cache entry (${network}): ${moment(update.time).format(
DAY_KEY_FORMAT,
)}`,
);
Expand All @@ -126,7 +110,7 @@ export abstract class InfluxDbClient {
cacheEntryToFetch.set(moment(update.time).format(DAY_KEY_FORMAT), update);
} else if (debug) {
logger.warn(
`[InfluxClient Found empty result entry while populating cache (${network}).
`[InfluxClient] Found empty result entry while populating cache (${network}).
${JSON.stringify(update)}`,
);
}
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

0 comments on commit 444c433

Please sign in to comment.