Skip to content

Commit

Permalink
Update stats.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lailongwei authored Nov 17, 2023
1 parent 605ec43 commit 1c501fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ def _log_response_time(self, response_time: int) -> None:
self.total_response_time += response_time

if self.min_response_time is None:
self.min_response_time = self.max_response_time = response_time
self.min_response_time = response_time
else:
self.min_response_time = min(self.min_response_time, response_time)
self.max_response_time = max(self.max_response_time, response_time)
self.max_response_time = max(self.max_response_time, response_time)

# to avoid to much data that has to be transferred to the master node when
# running in distributed mode, we save the response time rounded in a dict
Expand Down Expand Up @@ -634,8 +634,8 @@ def get_current_response_time_percentile(self, percent: float) -> Optional[int]:
cached: Optional[CachedResponseTimes] = None
if self.response_times_cache is not None:
for ts in acceptable_timestamps:
cached = self.response_times_cache.get(ts)
if cached is not None:
if ts in self.response_times_cache:
cached = self.response_times_cache[ts]
break

if cached:
Expand Down

0 comments on commit 1c501fc

Please sign in to comment.