fix: update connection.ts to always clear the heartbeat interval (#1942)

Co-authored-by: Jackson Mills <jmills@ripple.com>
Co-authored-by: Elliot Lee <github.public@intelliot.com>
This commit is contained in:
nitowa
2022-05-05 10:33:46 +02:00
committed by GitHub
parent 17d57abcd0
commit 95123392c4

View File

@@ -273,6 +273,7 @@ export class Connection extends EventEmitter {
* @returns A promise containing either `undefined` or a disconnected code, that resolves when the connection is destroyed.
*/
public async disconnect(): Promise<number | undefined> {
this.clearHeartbeatInterval()
if (this.reconnectTimeoutID !== null) {
clearTimeout(this.reconnectTimeoutID)
this.reconnectTimeoutID = null