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