ipfs-shipyard / ipfs-pubsub-1on1

1-to-1 communication channel over IPFS Pubsub between two peers
25 stars 11 forks source link

fix: end waitForPeers timer on closed channel #10

Closed mistakia closed 2 years ago

mistakia commented 4 years ago

I've noticed that some of my tests hang because of the waitForPeers timer is not resolving.

I believe what is happening is a test spins up two nodes, node1 resolves and closes the connection before node2 resolves, thus leaving node2 waiting for peers. The timer on node2 continues to run when the test ends and the channels are closed.

I've added a check in the timer to see if the channel has been closed to clear the timer.

tabcat commented 2 years ago

Supersedes #28 Closes #28

@haadcode @mistakia @vinkabuki

haadcode commented 2 years ago

I was about to comment on #28 and found here, which to me looks like it solves the problem described in https://github.com/orbitdb/orbit-db/issues/947.

Would it be possible to capture the error in a test, and then verify that this PR indeed fixes it?