1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-28 06:48:32 +09:00

精度を高めるためストリーミング接続中に定期的にlastActiveDateを更新するように

This commit is contained in:
syuilo 2021-04-18 22:35:47 +09:00
parent 203799871c
commit f984f56459

View File

@ -35,10 +35,22 @@ module.exports = (server: http.Server) => {
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', () => {
ev.removeAllListeners();
main.dispose();
redisClient.off('message', onRedisMessage);
if (intervalId) clearInterval(intervalId);
});
connection.on('message', async (data) => {
@ -46,11 +58,5 @@ module.exports = (server: http.Server) => {
connection.send('pong');
}
});
if (user) {
Users.update(user.id, {
lastActiveDate: new Date(),
});
}
});
};