From e0bc4ccdee95fa001b90ce6b0a44ef72c446069e Mon Sep 17 00:00:00 2001 From: aldenpeterson-wf Date: Wed, 22 Mar 2017 16:59:11 -0500 Subject: [PATCH] Fix off by 1 error in stats.py resulting in additional request always being run --- locust/stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locust/stats.py b/locust/stats.py index efa6a99840..7af358b3ed 100644 --- a/locust/stats.py +++ b/locust/stats.py @@ -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)]