*Move _connectBackoff retry to costructor so we don't create duplicate hooks
This commit is contained in:
parent
290ca18c4b
commit
1a4f33c697
|
@ -40,6 +40,10 @@ export class SwarmClient extends Client {
|
||||||
strategy: "fibo",
|
strategy: "fibo",
|
||||||
maxAttempts: Number.MAX_SAFE_INTEGER,
|
maxAttempts: Number.MAX_SAFE_INTEGER,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._connectBackoff.on("retry", (error: any) => {
|
||||||
|
this.logErr(error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get swarm(): number | undefined {
|
get swarm(): number | undefined {
|
||||||
|
@ -83,10 +87,6 @@ export class SwarmClient extends Client {
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
await this._connectBackoff.run(() => this.init());
|
await this._connectBackoff.run(() => this.init());
|
||||||
|
|
||||||
this._connectBackoff.on("retry", (error: any) => {
|
|
||||||
this.logErr(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
await this.ready();
|
await this.ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue