waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
167 stars 42 forks source link

chore: improve StreamManager #1994

Closed danisharora099 closed 4 months ago

danisharora099 commented 5 months ago

Problem

https://github.com/waku-org/js-waku/issues/1965

Solution

This PR:

Notes

Contribution checklist:

github-actions[bot] commented 5 months ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 181.37 KB (+0.08% 🔺) 3.7 s (+0.08% 🔺) 3.1 s (-39.28% 🔽) 6.7 s
Waku Simple Light Node 181.54 KB (+0.13% 🔺) 3.7 s (+0.13% 🔺) 3.8 s (+64.87% 🔺) 7.4 s
ECIES encryption 23.12 KB (+0.01% 🔺) 463 ms (+0.01% 🔺) 942 ms (+11.99% 🔺) 1.5 s
Symmetric encryption 22.58 KB (+0.23% 🔺) 452 ms (+0.23% 🔺) 1.1 s (+3.27% 🔺) 1.6 s
DNS discovery 72.49 KB (-0.02% 🔽) 1.5 s (-0.02% 🔽) 2.5 s (-3.03% 🔽) 3.9 s
Peer Exchange discovery 74.15 KB (+0.1% 🔺) 1.5 s (+0.1% 🔺) 2.6 s (+25.74% 🔺) 4.1 s
Local Peer Cache Discovery 67.68 KB (+0.08% 🔺) 1.4 s (+0.08% 🔺) 2.2 s (-5.33% 🔽) 3.6 s
Privacy preserving protocols 38.87 KB (-0.04% 🔽) 778 ms (-0.04% 🔽) 1.9 s (-18.72% 🔽) 2.6 s
Waku Filter 112.02 KB (+0.28% 🔺) 2.3 s (+0.28% 🔺) 3.1 s (+12.8% 🔺) 5.3 s
Waku LightPush 110.39 KB (+0.13% 🔺) 2.3 s (+0.13% 🔺) 3.4 s (+0.91% 🔺) 5.6 s
History retrieval protocols 110.91 KB (+0.14% 🔺) 2.3 s (+0.14% 🔺) 3.2 s (+24.81% 🔺) 5.5 s
Deterministic Message Hashing 7.29 KB (+0.71% 🔺) 146 ms (+0.71% 🔺) 358 ms (-26.31% 🔽) 504 ms
weboko commented 5 months ago

How does this PR address the main issue? Could you share knowledge about it, please.

danisharora099 commented 5 months ago

How does this PR address the main issue? Could you share knowledge about it, please.

My suspicion is that stream creation process and peer disconnection process are getting into a race condition where:

This PR: