Fix: Load mempool cache before checking DB connectivity.

This commit is contained in:
softsimon 2021-01-20 01:34:21 +07:00
parent 17b1325b3f
commit 1a04b088fb
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -61,6 +61,8 @@ class Server {
} }
startServer(worker = false) { startServer(worker = false) {
logger.debug(`Starting Mempool Server${worker ? ' (worker)' : ''}... (${backendInfo.getShortCommitHash()})`);
this.app this.app
.use((req: Request, res: Response, next: NextFunction) => { .use((req: Request, res: Response, next: NextFunction) => {
res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Origin', '*');
@ -72,6 +74,8 @@ class Server {
this.server = http.createServer(this.app); this.server = http.createServer(this.app);
this.wss = new WebSocket.Server({ server: this.server }); this.wss = new WebSocket.Server({ server: this.server });
diskCache.loadMempoolCache();
if (config.DATABASE.ENABLED) { if (config.DATABASE.ENABLED) {
checkDbConnection(); checkDbConnection();
} }
@ -85,7 +89,6 @@ class Server {
this.runMainUpdateLoop(); this.runMainUpdateLoop();
fiatConversion.startService(); fiatConversion.startService();
diskCache.loadMempoolCache();
if (config.BISQ_BLOCKS.ENABLED) { if (config.BISQ_BLOCKS.ENABLED) {
bisq.startBisqService(); bisq.startBisqService();
@ -101,7 +104,7 @@ class Server {
if (worker) { if (worker) {
logger.info(`Mempool Server worker #${process.pid} started`); logger.info(`Mempool Server worker #${process.pid} started`);
} else { } else {
logger.notice(`Mempool Server is running on port ${config.MEMPOOL.HTTP_PORT} (${backendInfo.getShortCommitHash()})`); logger.notice(`Mempool Server is running on port ${config.MEMPOOL.HTTP_PORT}`);
} }
}); });
} }