chore(core): improved logging
This commit is contained in:
parent
85f6610e09
commit
a7c7a636cd
2 changed files with 6 additions and 0 deletions
|
@ -360,6 +360,8 @@ export class MtClient extends EventEmitter {
|
||||||
* Close all connections and finalize the client.
|
* Close all connections and finalize the client.
|
||||||
*/
|
*/
|
||||||
async close(): Promise<void> {
|
async close(): Promise<void> {
|
||||||
|
this.log.debug('closing client')
|
||||||
|
|
||||||
this._config.destroy()
|
this._config.destroy()
|
||||||
await this.network.destroy()
|
await this.network.destroy()
|
||||||
|
|
||||||
|
@ -369,6 +371,8 @@ export class MtClient extends EventEmitter {
|
||||||
this._prepare.reset()
|
this._prepare.reset()
|
||||||
this._connect.reset()
|
this._connect.reset()
|
||||||
this._abortController.abort()
|
this._abortController.abort()
|
||||||
|
|
||||||
|
this.log.debug('client closed successfully')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -200,6 +200,7 @@ export class MtprotoSession {
|
||||||
if (!keepPending) {
|
if (!keepPending) {
|
||||||
for (const info of this.pendingMessages.values()) {
|
for (const info of this.pendingMessages.values()) {
|
||||||
if (info._ === 'rpc') {
|
if (info._ === 'rpc') {
|
||||||
|
this.log.debug('rejecting pending rpc %s', info.rpc.method)
|
||||||
info.rpc.promise.reject(new MtcuteError('Session is reset'))
|
info.rpc.promise.reject(new MtcuteError('Session is reset'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,6 +215,7 @@ export class MtprotoSession {
|
||||||
const rpc = this.queuedRpc.popFront()!
|
const rpc = this.queuedRpc.popFront()!
|
||||||
|
|
||||||
if (rpc.sent === false) {
|
if (rpc.sent === false) {
|
||||||
|
this.log.debug('rejecting pending rpc %s', rpc.method)
|
||||||
rpc.promise.reject(new MtcuteError('Session is reset'))
|
rpc.promise.reject(new MtcuteError('Session is reset'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue