holepunchto / hyperblobs

A blob store for Hypercore
Apache License 2.0
37 stars 9 forks source link

eventemitter leaks #4

Closed mafintosh closed 2 years ago

mafintosh commented 3 years ago

The read/write streams call toCallback on each creating. That method (if a promise hypercore is used) allocates listeners that are here never freed.

Can we make it so the toCallback happens once in the main constructor instead?

mafintosh commented 3 years ago

Would be nice to assume a promise based core instead also. You can easily do that with streamx using this pattern:

async _open (cb) {
  try {
    await this._openPromise()
  } catch (err) {
    return cb(err)
  }
  cb()
}
andrewosh commented 3 years ago

Yep makes sense -- FYI for anyone following along the v2 branch gets rid of the hypercore-promisifier entirely and assumes that you're using Hypercore 10 (with the Promises API).

mafintosh commented 2 years ago

fixed in master