Skip to content

Commit

Permalink
chore: remove delays
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jun 5, 2024
1 parent aa51a79 commit e94ac30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions packages/sdk/src/protocols/base_protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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.
*/
Expand All @@ -107,7 +96,6 @@ export class BaseProtocolSDK implements IBaseProtocolSDK {
return true;
}
}
await new Promise((resolve) => setTimeout(resolve, 1000));
}
return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit e94ac30

Please sign in to comment.