-
Notifications
You must be signed in to change notification settings - Fork 299
feat(breaking change): use stream on stats.bw #686
Conversation
Needed for ipfs/js-ipfs#1198 /cc @diasdavid 😄 The new tests for this to pass are here: ipfs-inactive/interface-js-ipfs-core#211 |
|
1561a69
to
3a56d56
Compare
3a56d56
to
6ae5288
Compare
Note to self: Pull Stream version not working. Still don't know why. |
src/stats/bw-pull-stream.js
Outdated
return p.end(err) | ||
} | ||
|
||
pull(toPull(stream), p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be simply
pull(pull.map(transformChunk), p)
if I understand it correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :D
This is passing with the tests from ipfs-inactive/interface-js-ipfs-core#211 😄 I think it's ready /cc @diasdavid |
Thanks @diasdavid! Once the tests pass I'll ping you. |
@diasdavid the failing tests are unrelated to Stats (stats are passing). I think we can merge this and release a new version 😄 so I can continue ipfs/js-ipfs#1198 |
stats.bw
has an option calledpoll
which allows the user to "tell" IPFS to send bandwidth stats each interval of time. We were collecting the response before calling the callback so that option would be useless.This way it sends a stream to the callback so the user can listen to
data
event which contains the Object.Interface IPFS core update: ipfs-inactive/interface-js-ipfs-core#211