Skip to content

Commit

Permalink
Start stats_printer_greenlet earlier, to make sure it works in headle…
Browse files Browse the repository at this point in the history
…ss/autostart LoadShape tests.
  • Loading branch information
cyberw committed Oct 18, 2021
1 parent aabe44d commit 08bc7e9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ def spawn_run_time_quit_greenlet():
gevent.spawn_later(options.run_time, stop_and_optionally_quit).link_exception(greenlet_exception_handler)

headless_master_greenlet = None
stats_printer_greenlet = None
if not options.only_summary and (options.print_stats or (options.headless and not options.worker)):
# spawn stats printing greenlet
stats_printer_greenlet = gevent.spawn(stats_printer(runner.stats))
stats_printer_greenlet.link_exception(greenlet_exception_handler)

def start_automatic_run():
if options.master:
Expand Down Expand Up @@ -400,12 +405,6 @@ def start_automatic_run():
)
input_listener_greenlet.link_exception(greenlet_exception_handler)

stats_printer_greenlet = None
if not options.only_summary and (options.print_stats or (options.headless and not options.worker)):
# spawn stats printing greenlet
stats_printer_greenlet = gevent.spawn(stats_printer(runner.stats))
stats_printer_greenlet.link_exception(greenlet_exception_handler)

if options.csv_prefix:
gevent.spawn(stats_csv_writer.stats_writer).link_exception(greenlet_exception_handler)

Expand Down

0 comments on commit 08bc7e9

Please sign in to comment.