mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-06 14:16:37 +00:00
fix: Stop sync before removing listeners.
This commit is contained in:
parent
a44323851f
commit
3b3f90501c
@ -255,13 +255,13 @@ const Sync = async ({ ipfs, log, events, onSynced, start, timeout }) => {
|
||||
*/
|
||||
const stopSync = async () => {
|
||||
if (started) {
|
||||
started = false
|
||||
await queue.onIdle()
|
||||
ipfs.libp2p.services.pubsub.removeEventListener('subscription-change', handlePeerSubscribed)
|
||||
ipfs.libp2p.services.pubsub.removeEventListener('message', handleUpdateMessage)
|
||||
await ipfs.libp2p.unhandle(headsSyncAddress)
|
||||
await ipfs.libp2p.services.pubsub.unsubscribe(address)
|
||||
peers.clear()
|
||||
started = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,10 +297,6 @@ describe('Write Permissions', function () {
|
||||
await db1.close()
|
||||
await db2.close()
|
||||
|
||||
await new Promise(resolve => {
|
||||
setTimeout(() => resolve(), 1000)
|
||||
})
|
||||
|
||||
db1 = await orbitdb1.open('write-test', { AccessController: OrbitDBAccessController() })
|
||||
db2 = await orbitdb2.open(db1.address)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user