Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stream2] 'finish' event should be emitted only after _store.close() #63

Closed
thomas-riccardi opened this issue Feb 12, 2015 · 2 comments
Closed

Comments

@thomas-riccardi
Copy link
Contributor

See nodejs v0.10 documentation:
http://nodejs.org/docs/v0.10.36/api/stream.html#stream_event_finish

When the end() method has been called, and all data has been flushed to the underlying system, this event is emitted.

Currently when the 'finish' event is emitted, the data is not flushed to GridFS since the _store.close() has not finished yet.

See nodejs/node-v0.x-archive#7348 for a discussion around 'finish' and 'close' events in such cases ('close' event is not normalized in the API, so it's not the right solution).
At the end of the thread there is a workaround: https://www.npmjs.com/package/flushwritable

@riaan53
Copy link
Contributor

riaan53 commented Feb 12, 2015

Hi @triccardi-systran ,

I saw that behavior and thought that the writeable stream saw gridfs-stream as the underlying system so then the finish event makes sense - but the data is not flushed to the gridstore at that moment like you said. I will try the workaround you provided.

Thanks!

Regards,
Riaan

@thomas-riccardi
Copy link
Contributor Author

It should be fixed by PR #67

@Reggino Reggino closed this as completed Feb 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants