Skip to content

Commit

Permalink
Only raise GreenletExit in TaskSet.run(), because that is the only pl…
Browse files Browse the repository at this point in the history
…ace it is really needed.
  • Loading branch information
cyberw committed Oct 26, 2019
1 parent 7cbdb69 commit 96d6759
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions locust/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ def run(self, *args, **kwargs):

while (True):
try:
if self.locust._state == LOCUST_STATE_STOPPING:
raise GreenletExit()

if self.locust.stop_timeout is not None and time() - self._time_start > self.locust.stop_timeout:
return

Expand All @@ -370,8 +373,6 @@ def run(self, *args, **kwargs):
try:
self.execute_next_task()
except RescheduleTaskImmediately:
if self.locust._state == LOCUST_STATE_STOPPING:
raise GreenletExit()
pass
except RescheduleTask:
self.wait()
Expand Down Expand Up @@ -435,8 +436,6 @@ def get_wait_secs(self):
return millis / 1000.0

def wait(self):
if self.locust._state == LOCUST_STATE_STOPPING:
raise GreenletExit()
self.locust._state = LOCUST_STATE_WAITING
self._sleep(self.get_wait_secs())
self.locust._state = LOCUST_STATE_RUNNING
Expand Down

0 comments on commit 96d6759

Please sign in to comment.