Refactored the DB class into a regular singleton class.

This commit is contained in:
softsimon
2022-04-13 17:38:42 +04:00
parent c18d525f4a
commit 427c1ca075
10 changed files with 45 additions and 49 deletions

View File

@@ -5,7 +5,7 @@ import * as WebSocket from 'ws';
import * as cluster from 'cluster';
import axios from 'axios';
import { checkDbConnection, DB } from './database';
import DB from './database';
import config from './config';
import routes from './routes';
import blocks from './api/blocks';
@@ -89,7 +89,7 @@ class Server {
diskCache.loadMempoolCache();
if (config.DATABASE.ENABLED) {
await checkDbConnection();
await DB.checkDbConnection();
try {
if (process.env.npm_config_reindex != undefined) { // Re-index requests
const tables = process.env.npm_config_reindex.split(',');