terminus
terminus copied to clipboard
change typeorm mongodb check
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/terminus/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [x] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
typeorm MongoDB check create a new connection everytime and will cause more load on MongoDB
What is the new behavior?
Reuse connection and run ping command
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Other information
Tested manually in an environment health check passed from 40/50ms to 4/8ms:
[Nest] 8 - 05/04/2024, 9:49:48 AM LOG [Network] 56b4c54a-c75a-4319-b9e9-12e3faa34542 - GET /health - 200 - 45ms
[Nest] 8 - 05/04/2024, 9:49:58 AM LOG [Network] 4913ef85-c83b-4ce4-8b61-38cea5341868 - GET /health - 200 - 49ms
[Nest] 8 - 05/04/2024, 9:58:57 AM LOG [Network] fb3aadb8-c4c0-4c15-b0cc-4302776747d4 - GET /health - 200 - 7ms
[Nest] 8 - 05/04/2024, 9:59:12 AM LOG [Network] df4ad42a-d612-49a7-bfdf-27a9a6e0550f - GET /health - 200 - 5ms