mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 05:12:35 +01:00
Set backend to out of sync after connection retry interval has exceeded.
This commit is contained in:
parent
a158794e2c
commit
9900f4da80
@ -29,10 +29,15 @@ class Mempool {
|
|||||||
setInterval(this.updateTxPerSecond.bind(this), 1000);
|
setInterval(this.updateTxPerSecond.bind(this), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public isInSync() {
|
public isInSync(): boolean {
|
||||||
return this.inSync;
|
return this.inSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setOutOfSync(): void {
|
||||||
|
this.inSync = false;
|
||||||
|
loadingIndicators.setProgress('mempool', 99);
|
||||||
|
}
|
||||||
|
|
||||||
public getLatestTransactions() {
|
public getLatestTransactions() {
|
||||||
return this.latestTransactions;
|
return this.latestTransactions;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import donations from './api/donations';
|
|||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
import backendInfo from './api/backend-info';
|
import backendInfo from './api/backend-info';
|
||||||
import loadingIndicators from './api/loading-indicators';
|
import loadingIndicators from './api/loading-indicators';
|
||||||
|
import mempool from './api/mempool';
|
||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
private wss: WebSocket.Server | undefined;
|
private wss: WebSocket.Server | undefined;
|
||||||
@ -120,6 +121,7 @@ class Server {
|
|||||||
const loggerMsg = `runMainLoop error: ${(e.message || e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
|
const loggerMsg = `runMainLoop error: ${(e.message || e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
|
||||||
if (this.currentBackendRetryInterval > 5) {
|
if (this.currentBackendRetryInterval > 5) {
|
||||||
logger.warn(loggerMsg);
|
logger.warn(loggerMsg);
|
||||||
|
mempool.setOutOfSync();
|
||||||
} else {
|
} else {
|
||||||
logger.debug(loggerMsg);
|
logger.debug(loggerMsg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user