Skip to content

Commit

Permalink
Parse options.stop_timeout earlier in main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Oct 28, 2022
1 parent a1c1b3a commit 9ad4be8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def main():
logger = logging.getLogger(__name__)
greenlet_exception_handler = greenlet_exception_logger(logger)

if options.stop_timeout:
try:
options.stop_timeout = parse_timespan(options.stop_timeout)
except ValueError:
logger.error("Valid --stop-timeout formats are: 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc.")
sys.exit(1)

if options.list_commands:
print("Available Users:")
for name in user_classes:
Expand Down Expand Up @@ -233,13 +240,6 @@ def main():
logger.error("Valid --run-time formats are: 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc.")
sys.exit(1)

if options.stop_timeout:
try:
options.stop_timeout = parse_timespan(options.stop_timeout)
except ValueError:
logger.error("Valid --stop-timeout formats are: 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc.")
sys.exit(1)

if options.csv_prefix:
stats_csv_writer = StatsCSVFileWriter(
environment, stats.PERCENTILES_TO_REPORT, options.csv_prefix, options.stats_history_enabled
Expand Down

0 comments on commit 9ad4be8

Please sign in to comment.