This repository was archived by the owner on Aug 9, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 "orbit-db-cache" : " ^0.3.0" ,
7171 "orbit-db-identity-provider" : " ^0.3.0" ,
7272 "orbit-db-storage-adapter" : " ^0.5.3" ,
73+ "p-timeout" : " ^3.2.0" ,
7374 "store" : " ^2.0.12" ,
7475 "tweetnacl" : " ^1.0.1" ,
7576 "tweetnacl-util" : " ^0.15.0"
Original file line number Diff line number Diff line change 11const path = require ( 'path' )
22const EventEmitter = require ( 'events' )
33const merge = require ( 'lodash.merge' )
4+ const pTimeout = require ( 'p-timeout' )
45const multiaddr = require ( 'multiaddr' )
56const OrbitDB = require ( 'orbit-db' )
67const Pubsub = require ( 'orbit-db-pubsub' )
@@ -247,15 +248,17 @@ class Replicator {
247248 async getAddressLinks ( ) {
248249 const entries = await this . rootstore . iterator ( { limit : - 1 } ) . collect ( )
249250 const linkEntries = entries . filter ( e => e . payload . value . type === entryTypes . ADDRESS_LINK )
250- const resolveLinks = linkEntries . map ( async entry => {
251+ const resolveLinks = [ ]
252+
253+ for ( const entry of linkEntries ) {
251254 const cid = entry . payload . value . data
252- // TODO handle missing ipfs obj??, timeouts?
253- const obj = ( await this . ipfs . dag . get ( cid ) ) . value
254- this . ipfs . pin . add ( cid )
255- obj . entry = entry
256- return obj
257- } )
258- return Promise . all ( resolveLinks )
255+ try {
256+ const dag = await pTimeout ( this . ipfs . dag . get ( cid ) , 2500 )
257+ resolveLinks . push ( Object . assign ( dag . value , { entry } ) )
258+ this . ipfs . pin . add ( cid )
259+ } catch ( e ) { }
260+ }
261+ return resolveLinks
259262 }
260263
261264 async getAuthData ( ) {
You can’t perform that action at this time.
0 commit comments