Skip to content

Commit

Permalink
Treat exceptions in init event handler as fatal and shut down locust …
Browse files Browse the repository at this point in the history
…right away.
  • Loading branch information
cyberw committed Dec 11, 2024
1 parent 35b07bb commit 41d6484
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ def assign_equal_weights(environment, **kwargs):
# Fire locust init event which can be used by end-users' code to run setup code that
# need access to the Environment, Runner or WebUI.
environment.events.init.fire(environment=environment, runner=runner, web_ui=web_ui)
if log.unhandled_greenlet_exception:
# treat exceptions in init handlers as fatal. They are already logged so no need to log anything more.
sys.exit(1)

if web_ui:
web_ui.start()
Expand Down

0 comments on commit 41d6484

Please sign in to comment.