Skip to content

Commit

Permalink
UBERF-6318: Fix server drop connection on connect (#5174)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo authored Apr 3, 2024
1 parent 76db760 commit bef6c03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/ws/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ClientSession implements Session {
useCompression: boolean = true
useBroadcast: boolean = false
sessionId = ''
lastRequest = 0
lastRequest = Date.now()

total: StatisticsElement = { find: 0, tx: 0 }
current: StatisticsElement = { find: 0, tx: 0 }
Expand Down
4 changes: 2 additions & 2 deletions server/ws/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ class TSessionManager implements SessionManager {
}
const now = Date.now()
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())
void this.close(s[1].socket, h[1].workspaceId, 1001, 'CLIENT_HANGOUT')
continue
}
if (diff > 20000 && this.ticks % 10 === 0) {
if (diff > 20000 && diff < 60000 && this.ticks % 10 === 0) {
void s[1].socket.send(
h[1].context,
{ result: 'ping' },
Expand Down

0 comments on commit bef6c03

Please sign in to comment.