fix: make service ready timeout configurable via CARTESI_SERVICE_READY_TIMEOUT#750
Closed
jplgarcia wants to merge 1 commit intocartesi:mainfrom
Closed
fix: make service ready timeout configurable via CARTESI_SERVICE_READY_TIMEOUT#750jplgarcia wants to merge 1 commit intocartesi:mainfrom
jplgarcia wants to merge 1 commit intocartesi:mainfrom
Conversation
397083d to
d4b4a59
Compare
The DefaultServiceTimeout constant is hard-coded to 5 seconds, which causes the inspect-server (and occasionally other services) to be killed by the supervisor before they finish initialising on slow or resource-constrained environments such as fly.io. Replace the constant with a package-level var that reads CARTESI_SERVICE_READY_TIMEOUT from the environment at process start. The value must be a valid Go duration string (e.g. "30s", "1m"). If the variable is absent or invalid the original 5-second default is preserved, so the change is fully backward-compatible. Tested on fly.io: inspect-server takes ~21 s to become ready; with CARTESI_SERVICE_READY_TIMEOUT=30s all services report ready and the node runs normally.
d4b4a59 to
6d24d01
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DefaultServiceTimeoutis hard-coded to 5 seconds. On slow or resource-constrained environments (e.g. fly.io) theinspect-server— and occasionally other services — take longer than 5 seconds to initialise, so the supervisor kills them and the node fails to start.Measured on fly.io:
inspect-servertakes ~21 seconds to become ready.Fix
Replace the
constwith a package-levelvarthat readsCARTESI_SERVICE_READY_TIMEOUTfrom the environment at process start:ReadyTimeoutandStopTimeoutfallbacks inSupervisorService.Start()DefaultServiceTimeoutusage inhttp.goTesting
Deployed on fly.io with
CARTESI_SERVICE_READY_TIMEOUT=30s:No
Service timed outerrors observed.