kappa-db / multifeed

Multi-writer hypercore.
135 stars 27 forks source link

ensure feed.key is only called after feed is ready #31

Closed m4gpi closed 4 years ago

m4gpi commented 4 years ago

been toying with inserting hyperdrive into multifeed, this is a snag that crops up, in functionaddMissingKeysLocked, _addFeed is called before the feed is ready, so it bombs out with:

  this._feedKeyToFeed[feed.key.toString('hex')] = feed
                               ^

TypeError: Cannot read property 'toString' of null
    at Multifeed._addFeed (/home/kyphae/Projects/cobox-core/node_modules/multifeed/index.js:67:32)
    at /home/kyphae/Projects/cobox-core/node_modules/multifeed/index.js:305:14
    at Array.forEach (<anonymous>)
    at addMissingKeysLocked (/home/kyphae/Projects/cobox-core/node_modules/multifeed/index.js:287:14)
    at /home/kyphae/Projects/cobox-core/node_modules/multifeed/index.js:274:9
    at call (/home/kyphae/Projects/cobox-core/node_modules/mutexify/index.js:6:5)
    at processTicksAndRejections (internal/process/next_tick.js:74:9)

This resolves it.

hackergrrl commented 4 years ago

Thank you Kieran! Published in 4.0.2.