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

on_request_xxx checks exiting condition against the wrong number #399

Closed
yalinhuang opened this issue Mar 31, 2016 · 0 comments
Closed

on_request_xxx checks exiting condition against the wrong number #399

yalinhuang opened this issue Mar 31, 2016 · 0 comments
Labels

Comments

@yalinhuang
Copy link

on_request_xxx() checks exiting condition before incrementing the relevant variables; this should be done in the reverse order.

A test run exits upon StopLocust exception is raised. The condition is checked every time a request is sent and responded (or failed). However the condition checking looks at the wrong number; for example, in on_request_success() in stats.py

def on_request_success(request_type, name, response_time, response_length):
    if global_stats.max_requests is not None and (global_stats.num_requests + global_stats.num_failures) >= global_stats.max_requests:
        raise StopLocust("Maximum number of requests reached")
    global_stats.get(name, request_type).log(response_time, response_length)

global_stats.num_requests is increased by one in the log() function after the condition is checked. This leads to sending one more requests than being asked to.

Was wondering if this design is intended? or?

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

No branches or pull requests

3 participants