*Move backoff reset to the ready method

This commit is contained in:
Derrick Hammer 2023-02-17 08:31:24 -05:00
parent 54a817742c
commit d3460ae956
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { Buffer } from "buffer"; import { Buffer } from "buffer";
import { Client, factory } from "@lumeweb/libkernel-universal"; import { Client, factory } from "@lumeweb/libkernel-universal";
import { hexToBuf, DataFn, ErrTuple } from "@siaweb/libweb"; import { DataFn, ErrTuple, hexToBuf } from "@siaweb/libweb";
import type { EventEmitter } from "eventemitter3"; import type { EventEmitter } from "eventemitter3";
@ -43,10 +43,7 @@ export class SwarmClient extends Client {
return createSocket(resp.id); return createSocket(resp.id);
} }
async init(): Promise<ErrTuple> { async init(): Promise<ErrTuple> {
const ret = await this.callModuleReturn("init", { swarm: this.swarm }); return await this.callModuleReturn("init", { swarm: this.swarm });
this._connectBackoff.reset();
return ret;
} }
async ready(): Promise<void> { async ready(): Promise<void> {
if (this._ready) { if (this._ready) {
@ -66,6 +63,7 @@ export class SwarmClient extends Client {
await this._ready; await this._ready;
this._ready = undefined; this._ready = undefined;
this._connectBackoff.reset();
} }
async start(): Promise<void> { async start(): Promise<void> {