You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define A "Started" atomic boolean, set it to False on startup.
Define A set of "Live" atomic booleans, current values are "LiveIndexDB" and "LiveEventDB", by default these all start as False.
Started also needs a atomic bool to be true (defaults to false) which is set once the chain indexer reaches tip for the first time.
When each DB is first connected, their respective flag is set True.
IF all three LIVE flags are true simultaneously, the "Started" flag gets set to true.
Started can not be set to False once it is set to True.
If "Started" is true, return NoContent, otherwise Service Unavailable.
On startup of the service, try and connect to each of the databases, keep trying until both are connected, at which point the initial connection check ceases.
Using the Liveness flags defined above: If a Flag is false, try and re-connect to the DB which is not Live.
If it can be contacted, set the flag to True.
After trying to reconnect to the DB's (if required), check if all Live flags are true, is so, return No Content, otherwise Service Unavailable.
Each Endpoint.
Before acting on an endpoint that needs either the Event DB or the Index DB, check if all the Live flags are True.
If any are False, immediately return "Service Unavailable" and do not execute the endpoint.
If ANY db interaction returns an error, set the respective Liveness flag to False, and return "Service Unavailable".
Endpoints DO not re-probe the DB to see if its now active, the health endpoint is solely responsible for re-establishing connection to the database if a connection fails.
Acceptance Criteria
Logic is implemented as outlined above.
Endpoint descriptions and documentation are updated to broadly reflect the above logic. (See the Kubernetes reference for details on how to document the endpoints aligining with Kubernetes expectations and our behaviour).
The text was updated successfully, but these errors were encountered:
Mr-Leshiy
changed the title
🛠️ [TASK] : Correct behaviour of Started/Ready/Live in the Health and Other endpoints
Correct behaviour of Started/Ready/Live in the Health and Other endpoints
Feb 11, 2025
Summary
Fix health statuses
Description
There are three health states:
See: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
for detailed explanation of how they are used.
Live - #1870
Started - #1921
Ready - #1919
Each Endpoint.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: