disconnect pong() listener when closing connection
This commit is contained in:
parent
840f589651
commit
3770f4a86a
1 changed files with 5 additions and 3 deletions
|
|
@ -270,8 +270,12 @@ export class StreamingApiServerService implements OnApplicationShutdown {
|
|||
if (user) {
|
||||
this.usersService.updateLastActiveDate(user);
|
||||
}
|
||||
const pong = () => {
|
||||
this.#connections.set(connection, Date.now());
|
||||
};
|
||||
|
||||
connection.once('close', () => {
|
||||
connection.off('pong', pong);
|
||||
ev.removeAllListeners();
|
||||
stream.dispose();
|
||||
this.#globalEv.off('message', onRedisMessage);
|
||||
|
|
@ -279,9 +283,7 @@ export class StreamingApiServerService implements OnApplicationShutdown {
|
|||
if (userUpdateIntervalId) clearInterval(userUpdateIntervalId);
|
||||
});
|
||||
|
||||
connection.on('pong', () => {
|
||||
this.#connections.set(connection, Date.now());
|
||||
});
|
||||
connection.on('pong', pong);
|
||||
});
|
||||
|
||||
// 一定期間通信が無いコネクションは実際には切断されている可能性があるため定期的にterminateする
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue