Skip to content

Commit

Permalink
Merge pull request #566 from aldenpeterson-wf/fix-off-by-one
Browse files Browse the repository at this point in the history
Fix off by 1 error in stats.py resulting in additional request always being off
  • Loading branch information
heyman authored Mar 23, 2017
2 parents 8793942 + e0bc4cc commit 33a0061
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ def median_from_dict(total, count):
"""

def on_request_success(request_type, name, response_time, response_length):
global_stats.get(name, request_type).log(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)

def on_request_failure(request_type, name, response_time, exception):
global_stats.get(name, request_type).log_error(exception)
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_error(exception)

def on_report_to_master(client_id, data):
data["stats"] = [global_stats.entries[key].get_stripped_report() for key in six.iterkeys(global_stats.entries) if not (global_stats.entries[key].num_requests == 0 and global_stats.entries[key].num_failures == 0)]
Expand Down

0 comments on commit 33a0061

Please sign in to comment.