Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use findOne in the orgs collection rather than find all from Cl… #803

Merged
merged 4 commits into from
Mar 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/routes/kube/kube.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ const timeInterval = 300000; //5 mintues
// /kube/liveness
const kube = router.get('/liveness', asyncHandler(async(req, res) => {
// does a db call to make sure we didnt disconnect
await require('../../apollo/models').models.Cluster.find({}, { _id:1 }, { limit:1 });
try {
await require('../../apollo/models').models.Organization.findOne({});
} catch (err) {
logger.error(err, 'razeedash-api liveness probe failed due to a mongo connection issue');
return res.sendStatus(503);
}

// TODO: not real pub-sub liveness test yet, will add later
if (pubSub.initRetries > 5) {
Expand Down