fix(hub): refresh session activity on completed turns (#524)

This commit is contained in:
Qianli Liu
2026-04-25 20:17:22 +08:00
committed by GitHub
parent 8118408796
commit 7f82df87c8
11 changed files with 311 additions and 7 deletions
+10 -1
View File
@@ -63,7 +63,12 @@ export class SyncEngine {
this.eventPublisher = new EventPublisher(sseManager, (event) => this.resolveNamespace(event))
this.sessionCache = new SessionCache(store, this.eventPublisher)
this.machineCache = new MachineCache(store, this.eventPublisher)
this.messageService = new MessageService(store, io, this.eventPublisher)
this.messageService = new MessageService(
store,
io,
this.eventPublisher,
(sessionId, updatedAt) => this.recordSessionActivity(sessionId, updatedAt)
)
this.rpcGateway = new RpcGateway(io, rpcRegistry)
this.reloadAll()
this.inactivityTimer = setInterval(() => this.expireInactive(), 5_000)
@@ -220,6 +225,10 @@ export class SyncEngine {
this.sessionCache.applyBackgroundTaskDelta(sessionId, delta)
}
recordSessionActivity(sessionId: string, updatedAt: number): void {
this.sessionCache.recordSessionActivity(sessionId, updatedAt)
}
handleMachineAlive(payload: { machineId: string; time: number }): void {
this.machineCache.handleMachineAlive(payload)
}