diff --git a/packages/sdk/src/protocols/base_protocol.ts b/packages/sdk/src/protocols/base_protocol.ts index b686350ba7..3360ae1227 100644 --- a/packages/sdk/src/protocols/base_protocol.ts +++ b/packages/sdk/src/protocols/base_protocol.ts @@ -32,17 +32,6 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { const maintainPeersInterval = options?.maintainPeersInterval ?? DEFAULT_MAINTAIN_PEERS_INTERVAL; - /** - * Trigger maintainPeers when a new peer is identified. - * This is useful to make the process of finding and adding new peers more dynamic and efficient, - * instead of relying on the interval only. - */ - this.core.addLibp2pEventListener("peer:identify", (evt) => { - const { protocols } = evt.detail; - if (protocols.includes(core.multicodec)) { - void this.maintainPeers(); - } - }); void this.startMaintainPeersInterval(maintainPeersInterval); } @@ -84,7 +73,7 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { /** * Checks if there are peers to send a message to. - * If there are no peers, tries to find new peers. + * If there are no peers, tries to find new peers from the ConnectionManager. * If no peers are found, returns false. * If peers are found, returns true. */ @@ -107,7 +96,6 @@ export class BaseProtocolSDK implements IBaseProtocolSDK { return true; } } - await new Promise((resolve) => setTimeout(resolve, 1000)); } return true; }; diff --git a/packages/sdk/src/protocols/light_push.ts b/packages/sdk/src/protocols/light_push.ts index 4e97448204..b915123ff4 100644 --- a/packages/sdk/src/protocols/light_push.ts +++ b/packages/sdk/src/protocols/light_push.ts @@ -50,7 +50,8 @@ class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK { }; } - if (!(await this.hasPeers())) { + const hasPeers = await this.hasPeers(); + if (!hasPeers) { return { successes, failures: [ diff --git a/packages/tests/tests/light-push/single_node/index.node.spec.ts b/packages/tests/tests/light-push/single_node/index.node.spec.ts index 8db4be1de4..a8b8835264 100644 --- a/packages/tests/tests/light-push/single_node/index.node.spec.ts +++ b/packages/tests/tests/light-push/single_node/index.node.spec.ts @@ -60,7 +60,7 @@ describe("Waku Light Push: Single Node", function () { }); }); - it.only("Push 30 different messages", async function () { + it("Push 30 different messages", async function () { const generateMessageText = (index: number): string => `M${index}`; for (let i = 0; i < 30; i++) {