Skip to content

Commit

Permalink
Merge pull request #2432 from tdadela/simplify_condition
Browse files Browse the repository at this point in the history
refactor(MasterRunner): simplify condition in check_stopped
  • Loading branch information
cyberw authored Oct 22, 2023
2 parents 0d1c03a + 3a6d08d commit 75594db
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,23 +900,9 @@ def quit(self) -> None:

def check_stopped(self) -> None:
if (
not self.state == STATE_INIT
and not self.state == STATE_STOPPED
and (
self.state == STATE_STOPPING
and all(
map(
lambda x: x.state == STATE_INIT,
self.clients.all,
)
)
)
or all(
map(
lambda x: x.state not in (STATE_RUNNING, STATE_SPAWNING, STATE_INIT),
self.clients.all,
)
)
self.state == STATE_STOPPING
and all(x.state == STATE_INIT for x in self.clients.all)
or all(x.state not in (STATE_RUNNING, STATE_SPAWNING, STATE_INIT) for x in self.clients.all)
):
self.update_state(STATE_STOPPED)

Expand Down

0 comments on commit 75594db

Please sign in to comment.