Skip to content

Liveness and Readiness endpoint improvement #4615

@Ferparishuertas

Description

@Ferparishuertas

PROBLEMS

Readiness endpoint is making a weird check that breaks the possibility to have custom chainids

if (result.indexOf('0x12') >= 0) {

Readiness and liveness are not taking into account redis, when enabled as part of the checks.

SOLUTION

  • Readiness.

    If redis not enabled, relay.eth().chainid should be returning a value != nul 0x
    If redis is enabled, asidr relay.eth().chainid should be returning a value != null, 0x, check if redis.ping() works.

  • Liveness.
    If redis no enabled, return 200 directly moe
    If redis is enabled, make something similar too

let healthStatus = redis: false ;

setInterval(async () => {

try {
await redis.ping();
healthStatus = true;
} catch {
healthStatus= false;
}
}, 30000); // Run every 30 seconds

app.get("/readonf", (req, res) => {
if (healthStatus) {
res.sendStatus(200);
} else {
res.status(503).json(healthStatus);
}
});

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions