waku-org / js-waku

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

feat: refactor `ConnectionManager` for maintainability #1969

Open danisharora099 opened 6 months ago

danisharora099 commented 6 months ago

This is a change request

Problem

We introduced a ConnectionManager a while ago to gain more control over how dials occur within a js-waku node, and slowly a lot of new APIs, refactors, etc started to bloat which is our current implementation. Our current implementation is ~580 lines, and very coupled together -- making it quite unreadable and unmaintainable.

Proposed Solutions

Split the ConnectionManager class into multiple classes, aiming to adhere to the Single Responsibility Principle.

Suggestions for the split based on the current type defs for the class:

Subtasks

Notes

some inspiration here: https://github.com/libp2p/js-libp2p/tree/main/packages/libp2p/src/connection-manager

weboko commented 6 months ago

Postponed till we have https://github.com/waku-org/js-waku/issues/1595 done