Skip to content

Commit

Permalink
allow configurable timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
silverbucket committed Feb 16, 2025
1 parent 1165c33 commit 3b4c188
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/connection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3b4c188

Please sign in to comment.