mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-06 22:26:41 +00:00
Fix Sync state
This commit is contained in:
parent
3f138ab98b
commit
2308f01a99
@ -153,6 +153,7 @@ const Sync = async ({ ipfs, log, events, onSynced, start }) => {
|
||||
}
|
||||
|
||||
const startSync = async () => {
|
||||
if (!started) {
|
||||
// Exchange head entries with peers when connected
|
||||
await ipfs.libp2p.handle(headsSyncAddress, handleReceiveHeads)
|
||||
ipfs.libp2p.pubsub.addEventListener('subscription-change', handlePeerSubscribed)
|
||||
@ -160,6 +161,7 @@ const Sync = async ({ ipfs, log, events, onSynced, start }) => {
|
||||
await ipfs.pubsub.subscribe(address, handleUpdateMessage)
|
||||
started = true
|
||||
}
|
||||
}
|
||||
|
||||
// Start Sync automatically
|
||||
if (start !== false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user