Skip to content

Commit

Permalink
Log a warning if on_stop/start have been tagged as tasks (as it is mu…
Browse files Browse the repository at this point in the history
…ch more likely that the user is confused that this is how it is supposed to be)
  • Loading branch information
cyberw committed Sep 20, 2020
1 parent 36ff2fc commit 9c8c73c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions locust/user/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def create_thread(self):
"""

def decorator_func(func):
if func.__name__ in ["on_stop", "on_start"]:
logging.warning(
"You have tagged your on_stop/start function with @task. This will make the method get called both as a task AND on stop/start."
) # this is usually not what the user intended
func.locust_task_weight = weight
return func

Expand Down

0 comments on commit 9c8c73c

Please sign in to comment.