FastHttpUser improvements (including a rename of parameter "url" to "path")#2083
Conversation
typing and more requests.model.Response like.
poll master.state up to 1.5 second timeout, instead of a static sleep.
create custom CompatRequest and use as it as request type.
|
ehm, really strange that two test cases in |
|
Nice! This looks like an improvement to me.
I agree that it would be a nice change. As long as we don't do it in a patch release, and clearly document it in the Docs' Changelog, I think it's worth doing. It should be a simple fix changing |
|
This is really odd. The |
|
Strange. I can have a look on Monday, on my way to our midsommer destination right now. |
|
Awesome, thanks. Glad midsommar! |
|
As far as I can tell, geventhttpclient never supported |
|
oh crap, I totally forgot to have a look at this today as promised (came back to a full calendar). |
|
I think I have it figured out, no worries :) |
|
seems like this is the commit that caused and I guess the |
|
👍 Hmm... I guess at the very least I should bump the minor version of geventhttpclient (and remove the 1.5.4 release) as that this is much more than a patch version change. Or should we do something else? |
|
@gwik was it intentional that geventhttpclient should ignore extra parameters? I dont have the whole "origin story" ;) |
|
I have changed geventhttpclient so that unknown arguments are not forwarded, thus restoring full backwards compatibility, even for strange use cases (released in 1.5.5, yanked 1.5.4) |
Sorry for the long "intro", which might seem irrelevant at first... but bear with me :)
In "my" project I had a case where I wanted to create a group of [async] requests, by running them in their own
greenlet.Normally it uses the
requestsclient viaHttpUser, but the wayrequestsis using theConnectionPoolfromurllib3is not thread-safe[0], which caused the requests to run more or less sequential instead.This lead me to using a
FastHttpSessionfor each async request, which worked great for that part. But instead ran into some typing issues, e.g.:Since
geventhttpclientisn't typed, this causesmypyto think thatheadersis alwaysNone, causing it to get typeNever, making it hard to actually use these attributes without usingtype: ignore-comments.The other
probleminconvenience I had, was thatlocust.contrib.fasthttp.FastResponsewas so different fromrequests.models.Response, causing "my" code that handles the response (for logging purposes) to get a bunch of special cases depending on what type of response it was. I've tried my best to make it easier to useFastHttpSessionas a drop-in replacement forHttpSession.One thing that I haven't changed, is that
locust.clients.HttpSession.requesthasurlas argument, where aslocust.contrib.fasthttp.FastHttpSession.requesthaspath. I would love to change that... but thought that it might be a too big breaking change(?).Also, once again I had problems with
test_runners::test_distributed_shape_with_fixed_users. I increased it in a previous PR from0.5to1.0, but seems like it sometimes is not enough, so now I changed somaster.statusis polled in agevent.Timeoutwith 3 seconds, instead of having a static sleep so the test shouldn't fail when it sometimes takes a little longer. That check would take at minimum 0.1 seconds and at maximum 3 seconds when it's actually is a problem.[0] psf/requests#1871