Open danisharora099 opened 1 month ago
This is a change request
For our compliance test: https://github.com/waku-org/js-waku/blob/6f188ef37978c93432774a5b3cac02e0b40fd184/packages/tests/tests/peer-exchange/compliance.spec.ts#L51-L54, we seem to wait 1000ms/1s, to ensure peer-exchange is mounted on the js-waku node.
This is quite hacky, and seems to introduce some race conditions as brought up by @gabrielmer.
Use a more predictable logic that waits for peer-exchange to be mounted. Eg: peerExchange.isMounted/peerExchange.on("mounted")
peerExchange.isMounted
peerExchange.on("mounted")
This is a change request
Problem
For our compliance test: https://github.com/waku-org/js-waku/blob/6f188ef37978c93432774a5b3cac02e0b40fd184/packages/tests/tests/peer-exchange/compliance.spec.ts#L51-L54, we seem to wait 1000ms/1s, to ensure peer-exchange is mounted on the js-waku node.
This is quite hacky, and seems to introduce some race conditions as brought up by @gabrielmer.
Proposed Solutions
Use a more predictable logic that waits for peer-exchange to be mounted. Eg:
peerExchange.isMounted
/peerExchange.on("mounted")