mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
chore: Catch heads iterator errors.
This commit is contained in:
parent
3b3f90501c
commit
0c3e7667f3
18
src/sync.js
18
src/sync.js
@ -142,15 +142,23 @@ const Sync = async ({ ipfs, log, events, onSynced, start, timeout }) => {
|
||||
let started = false
|
||||
|
||||
const onPeerJoined = async (peerId) => {
|
||||
const heads = await log.heads()
|
||||
events.emit('join', peerId, heads)
|
||||
try {
|
||||
const heads = await log.heads()
|
||||
events.emit('join', peerId, heads)
|
||||
} catch (err) {
|
||||
console.log('onPeerJoined', ipfs.libp2p.peerId.toString())
|
||||
}
|
||||
}
|
||||
|
||||
const sendHeads = async (source) => {
|
||||
return (async function * () {
|
||||
const heads = await log.heads()
|
||||
for await (const { bytes } of heads) {
|
||||
yield bytes
|
||||
try {
|
||||
const heads = await log.heads()
|
||||
for await (const { bytes } of heads) {
|
||||
yield bytes
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('onPeerJoined', ipfs.libp2p.peerId.toString())
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user