emit 'close' event after core has been closed. closed (#154).#157
Merged
mafintosh merged 1 commit intoholepunchto:masterfrom May 29, 2018
Merged
emit 'close' event after core has been closed. closed (#154).#157mafintosh merged 1 commit intoholepunchto:masterfrom
mafintosh merged 1 commit intoholepunchto:masterfrom
Conversation
mafintosh
reviewed
May 27, 2018
index.js
Outdated
| self.readable = false | ||
| self._storage.close(cb) | ||
| self._storage.close(function (err) { | ||
| self.emit('close') |
Contributor
There was a problem hiding this comment.
should only be emitted if no error occured during storage.close. Also mind adding a flag '.closed` or similar so we don't emit this twice?
Contributor
|
@rhodey nice catch! take a look at my comment. |
Author
|
@mafintosh thanks for the comments :) what do you think about my |
Contributor
|
This looks good to me |
Contributor
|
@rhodey oh mind adding a test? then we can't a regression in the future |
Contributor
|
6.15.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emit
closeevent after core has been closed. Maybe we don't want to emitcloseif the close callback is invoked with an error, I'm not sure. In my situation I think I prefer emitting the event even if close failed, because close will probably just keep failing again, and I'm more interested in "when is is OK to exit".Addresses issue report #154.