You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in packages/tests/src/utils/nodes.ts, we're using arbitrary delays (await delay(2000)) to ensure proper node setup and connection. These delays were added as a temporary fix to make tests pass, but they are not ideal as:
They make tests slower than necessary
They don't guarantee that the system is actually ready (could be too short in some cases)
They might be unnecessarily long in other cases
They make the tests less deterministic and reliable
Instead of using arbitrary delays, we should investigate implementing proper wait mechanisms based on specific log lines or node states.
Expected Behavior
The node setup and connection process should:
Use deterministic waiting mechanisms based on actual node states or specific log lines
Only wait as long as necessary for each operation
Fail fast with clear error messages when expected states aren't reached
Be reliable across different environments and network conditions
Steps to Reproduce
Current problematic code locations:
In packages/tests/src/utils/nodes.ts:
// First delay after waku node creationawaitdelay(2000);for(constnodeofserviceNodes.nodes){awaitwaku.dial(awaitnode.getMultiaddrWithId());awaitwaku.waitForPeers([Protocols.Filter,Protocols.LightPush]);constsuccess=awaitnode.ensureSubscriptions(...);// Second delay before waiting for logawaitdelay(2000);awaitnode.waitForLog(waku.libp2p.peerId.toString(),100);}
Run tests with npm test in the packages/tests directory
Tests pass but take longer than necessary due to fixed delays
Environment Details
js-waku packages version: latest
nwaku version: 0.34.0
Investigation Points
After waku node creation:
What specific state/log lines indicate the node is fully ready?
Can we use waitForLog with specific startup completion indicators?
Before waiting for peer logs:
What conditions need to be met before checking for peer logs?
Are there specific log lines or node states we can wait for?
Why is the current 100ms timeout for waitForLog insufficient without the delay?
Potential solutions to investigate:
Extend waitForLog to support multiple log lines in sequence
Add new wait mechanisms based on node state rather than logs
Implement proper retry mechanisms with backoff instead of fixed delays
Add more detailed logging to help identify exact ready states
The text was updated successfully, but these errors were encountered:
Description
Currently in
packages/tests/src/utils/nodes.ts
, we're using arbitrary delays (await delay(2000)
) to ensure proper node setup and connection. These delays were added as a temporary fix to make tests pass, but they are not ideal as:Instead of using arbitrary delays, we should investigate implementing proper wait mechanisms based on specific log lines or node states.
Expected Behavior
The node setup and connection process should:
Steps to Reproduce
Current problematic code locations:
In
packages/tests/src/utils/nodes.ts
:Run tests with
npm test
in the packages/tests directoryTests pass but take longer than necessary due to fixed delays
Environment Details
Investigation Points
After waku node creation:
waitForLog
with specific startup completion indicators?Before waiting for peer logs:
waitForLog
insufficient without the delay?Potential solutions to investigate:
waitForLog
to support multiple log lines in sequenceThe text was updated successfully, but these errors were encountered: