Skip to content

Commit

Permalink
perf: use findOne in the orgs collection rather than find all from Cl… (
Browse files Browse the repository at this point in the history
#803)

* perf: use findOne in the orgs collection rather than find all from Clusters

* Update app/routes/kube/kube.js

Co-authored-by: Adam King <rak@linux.vnet.ibm.com>

* Update kube.js

Co-authored-by: Adam King <rak@linux.vnet.ibm.com>
  • Loading branch information
dalehille and adamkingit committed Mar 4, 2021
1 parent 1b41c23 commit 6067ea1
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 6067ea1

Please sign in to comment.