-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
node-eclib.js
Outdated
this.reconstructFragment(availFragments, id, | ||
function recon(err, fragment) { | ||
if (err) { | ||
callback(err); | ||
return callback(err); |
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.
You cannot return early from a forEach and using this would call the callback multiple times. You would have to use a vanilla for loop or use some array method like arr.every
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.
thank you, it's my bad :(
node-eclib.js
Outdated
|
||
// Recover all missing fragments one by one. | ||
fragmentIds.forEach(function reconstructEach(id) { | ||
fragmentIds.forEach(function reconstructEach(id, index) { |
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.
Additionally, if you use an arrow function here you don't have to bind this for context.
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.
Tests are still running on node 0.10 (as can be seen with the CI) since the aim of this library was extensive compatibility. That means no arrow functions. We can probably jump our lowest threshold, but that would be a breaking change.
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.
Oh interesting. I didn't realize that this project was using node 0.10.
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.
I would like a test confirming that behaviour.
Fragments reconstruction runs in parallel. Hence recovered fragments could be not in right order. Fix sort function
0ea160b
to
0b699cf
Compare
A reinforced functional test for reconstructing multiple fragments is updated: #43 |
Merge to working branch |
Fragments reconstruction runs in parallel. Hence recovered fragments
could be not in right order.
Fix sort function