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

fix minor bug: ensure single database connection on server startup #2240

Conversation

lokeshwar777
Copy link
Contributor

What kind of change does this PR introduce?

bugfix

Issue Number:

Fixes #2161

Did you add tests for your changes?

No

Snapshots/Videos:

image

If relevant, did you update the documentation?

No

Summary

  1. This PR resolves a bug causing server errors due to an incorrect MongoDB URI in the loadPlugin function.
  2. It prevents multiple database connections during startup by implementing logic to check for existing connections before establishing a new one.

Does this PR introduce a breaking change?

No

Other information

Have you read the contributing guide?

Yes

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

src/db.ts Outdated Show resolved Hide resolved
palisadoes
palisadoes previously approved these changes Apr 21, 2024
Copy link

codecov bot commented Apr 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.43%. Comparing base (c0468a4) to head (6980bef).
Report is 516 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2240      +/-   ##
===========================================
+ Coverage    98.17%   98.43%   +0.25%     
===========================================
  Files          184      343     +159     
  Lines        10767    24799   +14032     
  Branches       835     2317    +1482     
===========================================
+ Hits         10571    24410   +13839     
- Misses         186      386     +200     
+ Partials        10        3       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@palisadoes
Copy link
Contributor

@meetulr Comments please

@meetulr
Copy link
Contributor

meetulr commented Apr 21, 2024

Yes, this is what I had in mind.

@lokeshwar777 I'd be better for the sake of clarity if you added a comment specifying what the check is doing, i.e. we're first checking if a connection already exists, if not, then only we're establishing a new one.

@palisadoes
Copy link
Contributor

palisadoes commented Apr 21, 2024

@lokeshwar777

Please add the check comments so that we can review and merge

@lokeshwar777 lokeshwar777 force-pushed the fix/minor-server-startup-bug branch 2 times, most recently from 251d5af to 6980bef Compare April 21, 2024 20:30
@palisadoes
Copy link
Contributor

@meetulr PTAL again

@meetulr
Copy link
Contributor

meetulr commented Apr 22, 2024

Yes this looks good.

@palisadoes palisadoes merged commit 3f59503 into PalisadoesFoundation:develop Apr 22, 2024
11 checks passed
@lokeshwar777 lokeshwar777 deleted the fix/minor-server-startup-bug branch May 24, 2024 19:34
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