| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Verified that @boneskull has signed the CLA. Thanks for the pull request! |
Sorry, something went wrong.
Pull Request Test Coverage Report for Build 1364
💛 - Coveralls |
Sorry, something went wrong.
|
@boneskull Overall the implementation looks good to me, but it looks like tests aren't passing on Node.js versions before 8.x — you'll need to ensure your code works correctly for versions all the way back to Node.js 4.0.0 |
Sorry, something went wrong.
|
The coverage % decreased because this PR adds more covered LoC to the project. I don't love how Coveralls calculates that... |
Sorry, something went wrong.
|
@mattwiller The failures have been fixed on Travis-CI |
Sorry, something went wrong.
| if (!this.destroyed) { | ||
| /* istanbul ignore else */ | ||
| if (typeof this.destroy === 'function') { | ||
| this.destroy(); |
There was a problem hiding this comment.
The Node.js Stream docs say that _destroy() is called by destroy() — why call back into destroy() here?
Sorry, something went wrong.
There was a problem hiding this comment.
Because destroy was not added until v8 of Node.
Sorry, something went wrong.
There was a problem hiding this comment.
(so if you called abort you might as well have called destroy if it exists. this is moot if I just conditionally add the method)
Sorry, something went wrong.
| * @returns {void} | ||
| * @public | ||
| */ | ||
| EventStream.prototype.abort = EventStream.prototype._destroy; |
There was a problem hiding this comment.
It's a bit undesirable to have two different methods to call depending on which version of Node.js the user is running. Is it possible to check if EventStream.prototype.destroy already exists and conditionally add/polyfill it if it doesn't?
Sorry, something went wrong.
There was a problem hiding this comment.
yeah, we could do that.
Sorry, something went wrong.
|
@mattwiller Build needs retry; Node.js v9 didn't seem to start. |
Sorry, something went wrong.
| }; | ||
|
|
||
| // backwards-compat for Node.js pre-v8.0.0 | ||
| if (!(typeof Readable.destroy === 'function')) { |
There was a problem hiding this comment.
You'll need to check against Readable.prototype.destroy here — this condition as written will always include the polyfill. Also, using !== might be more readable than !(... === ...)
Sorry, something went wrong.
There was a problem hiding this comment.
my bad
Sorry, something went wrong.
- add reference to long-polling timer on class - add `EventStream` method `_destroy()`, which clears any existing long-polling timer, and deletes it. Destroys stream if not already destroyed. Implements `Readable#_destroy` in Node.js v8.x and newer. - add polyfill for `Readable#destroy`, which isn't present pre-Node.js-v8.x - add checks for `destroyed` stream state which effectively abort various tasks in `EventStream` - consolidate long-polling retry logic into its own private method, `EventStream#retryLongPoll()`. - add tests for logic changes - add note in docs
|
@mattwiller addressed your latest comments |
Sorry, something went wrong.
|
@mattwiller Do you need anything else from me here? |
Sorry, something went wrong.
|
@mattwiller Possible to release this soon? |
Sorry, something went wrong.
|
@boneskull We're looking to push out a release later this week! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
long-polling timer, and deletes it. Destroys stream if not already
destroyed. Implements Readable#_destroy in Node.js v8.x and newer.
is not called via EventStream#destroy() in pre-Node.js-v8.x. Any
version can use this method; _destroy() is private.
various tasks in EventStream
EventStream#retryLongPoll().
It'd be helpful to have an integration test (without use of Sinon's fake timers) which asserts a destroyed stream doesn't still have tasks in the event loop. If it does, such a test should hang--ostensibly due to the infinite recursion--because of Mocha's v4.x+ behavior.
Originally, I discovered this problem when writing some test code which consumes an EventStream. I could determine that this implementation was correct, because my test code was no longer hanging indefinitely. 😄