fix(core): do not close connection by inactivity when there are pending queries
This commit is contained in:
parent
fb61bdc9f7
commit
ca1916c5cb
1 changed files with 18 additions and 0 deletions
|
@ -1473,6 +1473,24 @@ export class SessionConnection extends PersistentConnection {
|
||||||
protected _onInactivityTimeout() {
|
protected _onInactivityTimeout() {
|
||||||
// we should send all pending acks and other service messages
|
// we should send all pending acks and other service messages
|
||||||
// before dropping the connection
|
// before dropping the connection
|
||||||
|
// additionally, if we are still waiting for some rpc results,
|
||||||
|
// we should wait for them first
|
||||||
|
|
||||||
|
let hasPendingRpc = false
|
||||||
|
|
||||||
|
for (const it of this._session.pendingMessages.values()) {
|
||||||
|
if (it._ === 'rpc') {
|
||||||
|
hasPendingRpc = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPendingRpc) {
|
||||||
|
this.log.debug('waiting for pending rpc queries to finish before closing connection')
|
||||||
|
this._rescheduleInactivity()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!this._session.hasPendingMessages) {
|
if (!this._session.hasPendingMessages) {
|
||||||
this.log.debug('no pending service messages, closing connection')
|
this.log.debug('no pending service messages, closing connection')
|
||||||
|
|
Loading…
Reference in a new issue