kappa-db / multifeed

Multi-writer hypercore.
135 stars 27 forks source link

Bugfix: Fixed racing condition in multifeed#close() #33

Closed telamon closed 4 years ago

telamon commented 4 years ago

Steps to reproduce:

const multi = multifeed(...)
multi.close()
console.log(multi.closed) // => false
if (!multi.closed) multi.close()

Used to throw error:

< multifeed/index.js:121
<       feeds[n].close(function (err) {
<                ^
< TypeError: Cannot read property 'close' of undefined
<     at next (multifeed/index.js:121:16)
<     at multifeed/index.js:127:5
<     at call (multifeed/node_modules/mutexify/index.js:6:5)
<     at process._tickCallback (internal/process/next_tick.js:61:11)
hackergrrl commented 4 years ago

Looks great @telamon. :sparkles:

If you'd like, feel free to merge to master and publish on npm (I just gave you permissions).

P.S. Please also feel free to work on this remote as your git origin. You should have sufficient permissions to not need to dev on your fork.

On 09/08 09:11, Tony Ivanov wrote:

@telamon requested your review on: kappa-db/multifeed#33 Bugfix: Fixed racing condition in multifeed#close().

-- You are receiving this because your review was requested. Reply to this email directly or view it on GitHub: https://github.com/kappa-db/multifeed/pull/33#event-2616842715

telamon commented 4 years ago

Thanks @noffle ! I didn't actually know that i could use this repo as remote, now i know! :+1: