-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respond with 503 - Service Unavailable
while stacks-node is syncing
#698
Comments
While 503 is technically correct for the status during startup, i'd argue to use a custom 5XX status code here since health checks would see the We had a similar discussion for stacks-blockchain: stacks-network/stacks-core#2768 (comment) If the proposed |
I'm working on this issue |
@MHassanTariq might be best to hold off until stacks-network/stacks-core#2768 is completed or further along, since we'll likely copy their status code and the sync progress if possible. |
removing priority because this is on hold until 2768 is further along |
Hi, @zone117x. Given various improvements in upstream and Stacks Blockchain API, this is an old issue and likely not an issue anymore. When you get a chance, review this once more, and decide whether we can close this, please? |
It would probably still be helpful if the API responded with something to indicated sync status. However, any changes for that are still blocked on upstream, e.g. stacks-network/stacks-core#3729 (and potentially another change for that sync/health info to be pushed through the event emitter). |
When the API and stacks-node are both started, the API immediately boots the event observer http server in order to prevent an inter-process deadlock. However, the API waits until the stacks-node's http server is responsive to
/v2/info
before initializing it's own public http server. It does this because many endpoints will not function correctly until the stacks-node RPC server is responsive. The code responsible for this behavior is:https://github.com/blockstack/stacks-blockchain-api/blob/538d3b1fbd9f06edd407552a6c61671de1b45923/src/index.ts#L115-L121
While the stacks-node is initializing, it can be unresponsive for quite some time (hours in some cases), and the API can appear to be in a confusing state.
The API should init its public http server and respond with
503 - Service Unavailable
status during this period. The body should include the API's currently known block height in the response payload. Once stacks-network/stacks-core#2768 is ready, the API can use it to return a more useful syncing progress indicator.The text was updated successfully, but these errors were encountered: