UBERF-6318: Fix server drop connection on connect (#5174)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-04-04 01:03:03 +07:00 committed by GitHub
parent 76db760ae3
commit bef6c034a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ export class ClientSession implements Session {
useCompression: boolean = true useCompression: boolean = true
useBroadcast: boolean = false useBroadcast: boolean = false
sessionId = '' sessionId = ''
lastRequest = 0 lastRequest = Date.now()
total: StatisticsElement = { find: 0, tx: 0 } total: StatisticsElement = { find: 0, tx: 0 }
current: StatisticsElement = { find: 0, tx: 0 } current: StatisticsElement = { find: 0, tx: 0 }

View File

@ -144,12 +144,12 @@ class TSessionManager implements SessionManager {
} }
const now = Date.now() const now = Date.now()
const diff = now - s[1].session.lastRequest const diff = now - s[1].session.lastRequest
if (diff > 60000) { if (diff > 60000 && this.ticks % 10 === 0) {
console.log('session hang, closing...', h[0], s[1].session.getUser()) console.log('session hang, closing...', h[0], s[1].session.getUser())
void this.close(s[1].socket, h[1].workspaceId, 1001, 'CLIENT_HANGOUT') void this.close(s[1].socket, h[1].workspaceId, 1001, 'CLIENT_HANGOUT')
continue continue
} }
if (diff > 20000 && this.ticks % 10 === 0) { if (diff > 20000 && diff < 60000 && this.ticks % 10 === 0) {
void s[1].socket.send( void s[1].socket.send(
h[1].context, h[1].context,
{ result: 'ping' }, { result: 'ping' },