diff --git a/CHANGELOG.md b/CHANGELOG.md index 4373a96..6983633 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Timeout support for 'heroku run' (in case of networking, hanging or "server boot" tests etc), defaults to 60 s, global override `$HATCHET_DEFAULT_RUN_TIMEOUT`, per-test option `:timeout` - Delay for empty/timeout retries if run_multi is off, defaults to 1 s, global override `$HATCHET_RUN_RETRY_DELAY` - Record and print dyno id ("run.1234") in event of empty output or timeout retry +- Terminate dyno via API on timeout ## 7.4.0 diff --git a/lib/hatchet/heroku_run.rb b/lib/hatchet/heroku_run.rb index bc71569..060c160 100644 --- a/lib/hatchet/heroku_run.rb +++ b/lib/hatchet/heroku_run.rb @@ -122,7 +122,7 @@ def call rescue HerokuRunTimeoutError => e if @timeout_fail_count < 3 @timeout_fail_count += 1 - message = String.new("Run #{@dyno_id} with command #{@command} timed out after #{@timeout} seconds, retrying...") + message = String.new("Run #{@dyno_id} with command #{@command} timed out after #{@timeout} seconds, stopping dyno and retrying...") message << "\nstderr until moment of termination was: #{@result.stderr}" message << "\nstdout until moment of termination was: #{@result.stdout}" message << "\nTo disable pass in `timeout: 0` or set HATCHET_DEFAULT_RUN_TIMEOUT=0 globally" @@ -130,6 +130,7 @@ def call message << "\nreleases: #{@app.releases}" message << "\n#{caller.join("\n")}" @stderr.puts message + @app.platform_api.dyno.stop(@app.name, @dyno_id) if @dyno_id sleep(@retry_delay) # without run_multi, this will prevent occasional "can only run one free dyno" errors retry end