fix: reset is_online on server start, reduce heartbeat to 20s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,7 +72,7 @@ export function registerAgentWs(fastify: FastifyInstance) {
|
||||
socket.isAlive = false
|
||||
socket.ping()
|
||||
})
|
||||
}, 30000)
|
||||
}, 20000)
|
||||
|
||||
wss.on('close', () => clearInterval(heartbeat))
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ async function main() {
|
||||
await runMigrations()
|
||||
await seedIfEmpty()
|
||||
|
||||
// При рестарте сервера все агенты считаются офлайн — они переподключатся сами
|
||||
await db.query('UPDATE workstations SET is_online = false').catch(() => {})
|
||||
console.log('[server] Reset all workstations to offline')
|
||||
|
||||
await redis.connect()
|
||||
console.log('[redis] Connected')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user