Skip to content

fix: add more context to readiness check - #1218

Merged
mutambaraf merged 7 commits into
developfrom
uop-update-readiness-check
Oct 22, 2025
Merged

fix: add more context to readiness check#1218
mutambaraf merged 7 commits into
developfrom
uop-update-readiness-check

Conversation

@mutambaraf

Copy link
Copy Markdown
Contributor

Description

This PR upgrades the /readiness health check to provide dependency information and also improve how we send back HTTP status codes.

Motivation and Context

How Has This Been Tested

Manual

{
    "application": {
        "status": "UP",
        "database": {
            "status": "UP",
            "message": "Connected"
        }
    }
}

Fixes

Changes

  • 200 OK: Application is running and all critical dependencies (database) are available.
  • 503 Service Unavailable: Application is running, but the database connection check failed.
  • 500 Internal Server Error : Application is having internal errors, not able to check database connection .

Depends on

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@mutambaraf
mutambaraf requested a review from a team as a code owner October 10, 2025 15:23
@mutambaraf
mutambaraf requested review from a team, William-Edwards-STFC and bolmsten and removed request for a team October 10, 2025 15:23
Comment thread apps/backend/src/middlewares/readinessCheck.ts Outdated
Comment thread apps/backend/src/middlewares/readinessCheck.ts Outdated
.catch((e) => {
logger.logException('Readiness check failed', e);
res.status(500).end();
await baseContext.queries.system.connectivityCheck().then((success) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have then, catch, if we are going to use await?

@yoganandaness

Copy link
Copy Markdown
Contributor

@mutambaraf I noticed that, we are querying settings table for health check. Could we change it to select 1 to keep it light weight

.raw('select * FROM "settings" LIMIT 1')

@yoganandaness yoganandaness left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @mutambaraf

@mutambaraf
mutambaraf merged commit 785a577 into develop Oct 22, 2025
22 checks passed
@mutambaraf
mutambaraf deleted the uop-update-readiness-check branch October 22, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants