mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 11:57:34 -07:00
精度を高めるためストリーミング接続中に定期的にlastActiveDateを更新するように
This commit is contained in:
parent
f91e8a9535
commit
f99f919e4c
1 changed files with 12 additions and 6 deletions
|
@ -35,10 +35,22 @@ module.exports = (server: http.Server) => {
|
||||||
|
|
||||||
const main = new MainStreamConnection(connection, ev, user, app);
|
const main = new MainStreamConnection(connection, ev, user, app);
|
||||||
|
|
||||||
|
const intervalId = user ? setInterval(() => {
|
||||||
|
Users.update(user.id, {
|
||||||
|
lastActiveDate: new Date(),
|
||||||
|
});
|
||||||
|
}, 1000 * 60 * 5) : null;
|
||||||
|
if (user) {
|
||||||
|
Users.update(user.id, {
|
||||||
|
lastActiveDate: new Date(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
connection.once('close', () => {
|
connection.once('close', () => {
|
||||||
ev.removeAllListeners();
|
ev.removeAllListeners();
|
||||||
main.dispose();
|
main.dispose();
|
||||||
redisClient.off('message', onRedisMessage);
|
redisClient.off('message', onRedisMessage);
|
||||||
|
if (intervalId) clearInterval(intervalId);
|
||||||
});
|
});
|
||||||
|
|
||||||
connection.on('message', async (data) => {
|
connection.on('message', async (data) => {
|
||||||
|
@ -46,11 +58,5 @@ module.exports = (server: http.Server) => {
|
||||||
connection.send('pong');
|
connection.send('pong');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user) {
|
|
||||||
Users.update(user.id, {
|
|
||||||
lastActiveDate: new Date(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue