mirror of
https://github.com/mempool/mempool.git
synced 2024-11-19 01:41:01 +01:00
Fix acceleration websocket ping/pong
This commit is contained in:
parent
7d3d59c348
commit
f1e2c893cc
@ -49,8 +49,8 @@ class AccelerationApi {
|
||||
private websocketPath = config.MEMPOOL_SERVICES?.API ? `${config.MEMPOOL_SERVICES.API.replace('https://', 'wss://').replace('http://', 'ws://')}/accelerator/ws` : '/';
|
||||
private _accelerations: Record<string, Acceleration> = {};
|
||||
private lastPoll = 0;
|
||||
private lastPing = 0;
|
||||
private lastPong = 0;
|
||||
private lastPing = Date.now();
|
||||
private lastPong = Date.now();
|
||||
private forcePoll = false;
|
||||
private myAccelerations: Record<string, { status: MyAccelerationStatus, added: number, acceleration?: Acceleration }> = {};
|
||||
|
||||
@ -283,6 +283,7 @@ class AccelerationApi {
|
||||
|
||||
this.ws.on('pong', () => {
|
||||
logger.debug('received pong from acceleration websocket server');
|
||||
this.lastPong = Date.now();
|
||||
});
|
||||
} else {
|
||||
if (this.lastPing > this.lastPong && Date.now() - this.lastPing > 10000) {
|
||||
|
Loading…
Reference in New Issue
Block a user