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

Added user-defined wait_function to locust and TaskSet #785

merged 4 commits into from Apr 27, 2018


Copy link

@ps-george ps-george commented Apr 27, 2018

Most real-world inter-arrival times are exponentially distributed so it would be nice to be able to model that using locust. I've added the possibility for a user-defined wait_function, so any desired inter-arrival time can be modelled. Added some examples of exponential wait times I'd like to be able to model. If wait_function is not set, it will default to exactly as before, i.e. random.randint(self.min_wait,self.max_wait)

Change-log needs updating if merging this.

Copy link

codecov bot commented Apr 27, 2018

Codecov Report

Merging #785 into master will increase coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #785      +/-   ##
+ Coverage   64.99%   65.26%   +0.26%     
  Files          14       14              
  Lines        1417     1422       +5     
  Branches      222      224       +2     
+ Hits          921      928       +7     
+ Misses        444      443       -1     
+ Partials       52       51       -1
Impacted Files Coverage Δ
locust/ 79.5% <100%> (+0.52%) ⬆️
locust/ 89.88% <0%> (+2.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04e1bb2...469edf8. Read the comment docs.

Copy link

heyman commented Apr 27, 2018

Thanks for the PR!

This is currently possible to achieve by overriding the wait() method in the TaskSet class. However I think this is a nicer API. This would also resolve #18 :).

I'm +1

Does anyone else has thoughts on this?

Copy link

+1 as well. I wish it was easier to figure out what sections of docs to update short of having them all memorized.

Also this is a great PR example too. A small, concise, clear feature request with a good API... 🏆

@heyman heyman merged commit 28340a8 into locustio:master Apr 27, 2018
Copy link

thanks for including an example too!

Copy link
Contributor Author

Thanks for the fast and welcoming response!

Copy link

@ps-george realistically it's easy in a PR like this ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants