-
Notifications
You must be signed in to change notification settings - Fork 28
Chunked writeString
version working under aff-4.0.0 + related test cases
#55
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
Conversation
e53ccde
to
971eceb
Compare
I just noticed that in my commit coding style is mixed too ;-) |
I think that |
Great job! I've run the tests and looked at the code. Only some warnings of unused imports in the Regarding style, I think I'd prefer ASCII. No big deal though. If you'd like to change your stuff that is nice, otherwise you can leave it. I've probably committed with different styles all over the place. |
I agree regarding |
I've left those fixes to separate commit (to ease code review) and finally forgotten to make this cleanup ;-)
Yeah, I'm going to check if that is feasible soon ;-) |
I've got somewhat good news... it seems that this whole tango with chunking was completely unnecessary. Not to mention my test "buffers" etc. I've started to test buffer https://gist.github.com/paluh/34eb571bd02ac60cf7af8117bfbb0081 Like I've just said - I'm able to use up to 250 MB chunk size and serve it at once. I'm just not able to create larger string (I'm getting Of course if we want to serve really large files we have to provide some streaming mechanisms... but to be honest - serving large files from node/hyper is not on my priority list ;-) Tommorow I will test everything again and probably provide another pull request... |
From Node.Stream.writeString docs: "Returns false if the stream wishes for the calling code to wait for the 'drain' event to be emitted before continuing to write additional data; otherwise true." So it seems that it is enough to just wait till writing has finished which is done by our Aff continuation. I'm not sure but situation can be a bit more complicated if we take Aff Fibers into account and consider other "concurrent" writes...
Current version of my pull request is a huge simplification and it seems that it fixes this problem. I've tested concurrent fetch (using 10 instances of https://gist.github.com/paluh/b3343ccf64ab82ed7d820b11ed5d2687 |
I'm not entirely sure why but it seems that travis runs test which is no longer on my branch. There is no such test spec as |
I've cleared travis cache for this one too and it passes now. |
@paluh All right! Haven't checked fully yet, but guessing the generated CommonJS modules are cached, and found by the test runner: Cache: https://github.com/owickstrom/hyper/blob/master/.travis.yml#L70 We should perhaps not cache the |
To remind me, does this make #38 obsolete? :) |
@owickstrom Yeah, it makes #38 obsolete. Can I close #38 and merge this PR? |
@paluh Yes, thanks! |
I've made clean version of this pull request from
master
. I've merged your commit for chunked write and adapted it to aff-4.0.0 in my next commit, so we have quite clear history log.I've also provided test cases (one of them were failing without these fixes) with simple writable
Stream
implementation... Unfortunately I'm not able to reproduce empty string problem, so I have to ensure if it is still an issue.Regarding coding style, I've noticed that unicode is mixed with ASCII versions of some language constructs. For example in
Hyper.Node.Server
you can findforall
and ∀. I have used unicode in my commits, but I don't have any strong preference and I can change that....Maybe we should stick to one coding style and add some note to the "contributing" section in README? Of course I can help adapt current state of hyper code base.