Skip to content

Respond with 503 - Service Unavailable while stacks-node is syncing #698

Open
@zone117x

Description

@zone117x

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions