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
{{ message }}
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
I noticed that my StartupCheck is executed twice. I'm not sure if I'm using it wrong or is it by design. Please help me to understand.
I have a simple Express app
const express = require('express');
const path = require('path');
const health = require('@cloudnative/health-connect');
const healthCheck = new health.HealthChecker();
const app = express();
const startPromise = () =>{
console.log('Start Promise Is called.');
return new Promise((resolve, reject) => {
if (true) {
console.log('Start Up Check Promise called');
resolve();
} else {
reject();
}
});
}
const livePromise = () =>
new Promise((resolve, reject) => {
if (true) {
console.log('Liveness probe called');
resolve();
} else reject();
});
const liveCheck = new health.LivenessCheck('liveCheck', livePromise);
healthCheck.registerLivenessCheck(liveCheck);
const ReadinessCheckPromise = () =>
new Promise((resolve, reject) => {
if (true) {
console.log('Readiness Check called');
resolve();
} else reject();
});
const readinessCheck = new health.ReadinessCheck('ReadinessCheck', ReadinessCheckPromise);
healthCheck.registerReadinessCheck(readinessCheck);
app.use('/status/live', health.LivenessEndpoint(healthCheck));
app.use('/status/ready', health.ReadinessEndpoint(healthCheck));
app.use('/status/healthz', health.HealthEndpoint(healthCheck));
app.listen(3000, () => {
console.log('running on port 3000');
const startCheck = new health.StartupCheck('startCheck', startPromise);
healthCheck.registerStartupCheck(startCheck);
});
In the logs I see
On App Start , the logs look
MUI running on port 3000
Start Promise Is called.
Start Up Check Promise called
On localhost:3000/status/ready:
MUI running on port 3000
Start Promise Is called.
Start Up Check Promise called
++Start Promise Is called.
++Start Up Check Promise called
++Readiness Check called
++Liveness probe called
++ are marked as Added New Lines
I understand Readiness will perform Liveness check too (once), but why does it perform On StartUp too?
If I do another localhost:3000/status/ready
the logs look
MUI running on port 3000
Start Promise Is called.
Start Up Check Promise called
Start Promise Is called.
Start Up Check Promise called
Readiness Check called
Liveness probe called
++ Readiness Check called
Only one line added, as expected.
The text was updated successfully, but these errors were encountered:
I noticed that my StartupCheck is executed twice. I'm not sure if I'm using it wrong or is it by design. Please help me to understand.
I have a simple Express app
In the logs I see
On App Start , the logs look
On localhost:3000/status/ready:
++ are marked as Added New Lines
I understand Readiness will perform Liveness check too (once), but why does it perform On StartUp too?
If I do another localhost:3000/status/ready
the logs look
Only one line added, as expected.
The text was updated successfully, but these errors were encountered: