-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Clean up and optimize http.batch(), fix batchPerHost #1259
Conversation
This is necessary for us to refactor the http.batch() method, mostly because of dop251/goja#84 ( specifically, for https://github.com/loadimpact/k6/blob/a2e1c6f4e6207d69461a1b0f24c3aa2c72233101/js/modules/k6/http/response.go#L36-L38 )
Codecov Report
@@ Coverage Diff @@
## master #1259 +/- ##
=========================================
+ Coverage 75.31% 75.4% +0.08%
=========================================
Files 149 150 +1
Lines 10844 10883 +39
=========================================
+ Hits 8167 8206 +39
Misses 2211 2211
Partials 466 466
Continue to review full report at Codecov.
|
I think a slight further optimization of this could be using a slice+atomic instead of a buffered channel, and using a double pointer instead of copying the response data |
45fef98
to
016152d
Compare
This adds a minor breaking change - if some of the requests in the http.batch() fail, now the first error would be returned instead of the last one.
e00691e
to
079f63c
Compare
079f63c
to
f950d67
Compare
This removes unnecessary goroutine spawning, synchronization, type conversion, etc. I had to update goja because of dop251/goja#84, since I needed to refactor this:https://github.com/loadimpact/k6/blob/a2e1c6f4e6207d69461a1b0f24c3aa2c72233101/js/modules/k6/http/response.go#L36-L38
I also reduced the default
batchPerHost
value from 20 to 6, so k6 would be more in-line with browsers. Also, thanks to @mstoykov and #1264, the default value ofbatchPerHost
now actually works.Closes #767 and #967 (because of the goja update)