Skip to content

fix: atlas connection keeps reconnecting #373

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

Merged
merged 1 commit into from
Jul 15, 2025
Merged

Conversation

fmenezes
Copy link
Collaborator

@fmenezes fmenezes commented Jul 15, 2025

Proposed changes

Fix atlas connection keeps reconnecting

Checklist

@fmenezes fmenezes marked this pull request as ready for review July 15, 2025 13:24
@Copilot Copilot AI review requested due to automatic review settings July 15, 2025 13:24
@fmenezes fmenezes requested a review from a team as a code owner July 15, 2025 13:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents the client from repeatedly disconnecting when the Atlas cluster status is unknown, which was causing a reconnect loop.

  • Group the unknown state with connecting so it no longer falls through to the default disconnect logic
  • Removed the standalone case "unknown": under the disconnect branch
  • No tests were added to verify the new handling of unknown status
Comments suppressed due to low confidence (1)

src/tools/atlas/connect/connectCluster.ts:214

  • Add or update unit tests to cover the 'connecting' and 'unknown' cases to ensure the client does not reconnect unexpectedly and to prevent regressions.
                case "connecting":

@@ -211,12 +211,12 @@ export class ConnectClusterTool extends AtlasToolBase {
],
};
}
case "connecting": {
case "connecting":
case "unknown": {
Copy link
Preview

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

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

Consider logging when the status is 'unknown' so that developers can trace when and why the cluster enters this state, instead of silently ignoring it.

Suggested change
case "unknown": {
case "unknown": {
logger.warn(
LogId.atlasUnknownState,
"atlas-connect-cluster",
`Cluster "${clusterName}" in project "${projectId}" entered an unknown state.`
);

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no need, this is just a missed db ping

@fmenezes fmenezes enabled auto-merge (squash) July 15, 2025 13:30
@fmenezes fmenezes merged commit a698a48 into main Jul 15, 2025
19 checks passed
@fmenezes fmenezes deleted the fix_atlas_connection branch July 15, 2025 13:31
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 16294515117

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 77.39%

Totals Coverage Status
Change from base Build 16292877152: 0.005%
Covered Lines: 2828
Relevant Lines: 3611

💛 - Coveralls

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