*Move _connectBackoff retry to costructor so we don't create duplicate hooks

This commit is contained in:
Derrick Hammer 2023-03-19 14:03:24 -04:00
parent 290ca18c4b
commit 1a4f33c697
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

@ -40,6 +40,10 @@ export class SwarmClient extends Client {
strategy: "fibo",
maxAttempts: Number.MAX_SAFE_INTEGER,
});
this._connectBackoff.on("retry", (error: any) => {
this.logErr(error);
});
}
get swarm(): number | undefined {
@ -83,10 +87,6 @@ export class SwarmClient extends Client {
async start(): Promise<void> {
await this._connectBackoff.run(() => this.init());
this._connectBackoff.on("retry", (error: any) => {
this.logErr(error);
});
await this.ready();
}