Skip to content

Commit

Permalink
renamed shape_last_state to shape_last_tick
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelspagl committed Sep 7, 2022
1 parent 696ba58 commit 1c74db8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self, environment: "Environment") -> None:
self.state = STATE_INIT
self.spawning_greenlet: Optional[gevent.Greenlet] = None
self.shape_greenlet: Optional[gevent.Greenlet] = None
self.shape_last_state: Union[Tuple[int, float], Tuple[int, float, Optional[List[Type[User]]]], None] = None
self.shape_last_tick: Union[Tuple[int, float], Tuple[int, float, Optional[List[Type[User]]]], None] = None
self.current_cpu_usage: int = 0
self.cpu_warning_emitted: bool = False
self.worker_cpu_warning_emitted: bool = False
Expand Down Expand Up @@ -362,9 +362,9 @@ def shape_worker(self) -> None:
else:
self.stop()
self.shape_greenlet = None
self.shape_last_state = None
self.shape_last_tick = None
return
elif self.shape_last_state == current_tick:
elif self.shape_last_tick == current_tick:
gevent.sleep(1)
else:
if len(current_tick) == 2:
Expand All @@ -387,7 +387,7 @@ def shape_worker(self) -> None:
# `(user_count - prev_user_count) / spawn_rate` in order to limit the runtime
# of each load test shape stage.
self.start(user_count=user_count, spawn_rate=spawn_rate, user_classes=user_classes)
self.shape_last_state = current_tick
self.shape_last_tick = current_tick

def stop(self) -> None:
"""
Expand All @@ -410,7 +410,7 @@ def stop(self) -> None:
if self.shape_greenlet is not None:
self.shape_greenlet.kill(block=True)
self.shape_greenlet = None
self.shape_last_state = None
self.shape_last_tick = None

self.stop_users(self.user_classes_count)

Expand Down Expand Up @@ -889,7 +889,7 @@ def stop(self, send_stop_to_client: bool = True) -> None:
):
self.shape_greenlet.kill(block=True)
self.shape_greenlet = None
self.shape_last_state = None
self.shape_last_tick = None

self._users_dispatcher = None

Expand Down

0 comments on commit 1c74db8

Please sign in to comment.