Skip to content

Commit

Permalink
Workaround for #1726 Clarify some variable names while I'm at it.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Mar 11, 2021
1 parent 5fa62fd commit 0d58646
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,18 @@ def stop_users(self, user_count, stop_rate=None):
bucket = self.weight_users(user_count)
user_count = len(bucket)
to_stop = []
for g in self.user_greenlets:
for l in bucket:
user = g.args[0]
if isinstance(user, l):
for user_greenlet in self.user_greenlets:
try:
user = user_greenlet.args[0]
except IndexError:
logger.error(
"While stopping users, we encountered a user that didnt have proper args %s", user_greenlet
)
continue
for user_class in bucket:
if isinstance(user, user_class):
to_stop.append(user)
bucket.remove(l)
bucket.remove(user_class)
break

if not to_stop:
Expand Down

0 comments on commit 0d58646

Please sign in to comment.