From 3b4c188ca71c60eaba247101de4315097a379c6d Mon Sep 17 00:00:00 2001 From: Nick Jennings Date: Sun, 16 Feb 2025 15:42:00 +0100 Subject: [PATCH] allow configurable timeout --- packages/connection/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/connection/index.js b/packages/connection/index.js index 600ea1ff..96faa5f3 100644 --- a/packages/connection/index.js +++ b/packages/connection/index.js @@ -122,9 +122,9 @@ class Connection extends EventEmitter { try { await promise(this, "disconnect"); - const { domain, lang } = this.options; + const { domain, lang, timeout } = this.options; await this.connect(service); - await this.open({ domain, lang }); + await this.open({ domain, lang, timeout }); } catch (err) { this.emit("error", err); } @@ -209,13 +209,13 @@ class Connection extends EventEmitter { throw new Error("Connection is not offline"); } - const { service, domain, lang } = this.options; + const { service, domain, lang, timeout } = this.options; await this.connect(service); const promiseOnline = promise(this, "online"); - await this.open({ domain, lang }); + await this.open({ domain, lang, timeout }); return promiseOnline; } @@ -301,8 +301,8 @@ class Connection extends EventEmitter { */ async restart() { this._detachParser(); - const { domain, lang } = this.options; - return this.open({ domain, lang }); + const { domain, lang, timeout } = this.options; + return this.open({ domain, lang, timeout }); } async send(element) {