Skip to content

Commit f331bac

Browse files
committed
Cleanup comments
1 parent bd69450 commit f331bac

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/common/atlas/cluster.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ClusterDescription20240805, FlexClusterDescription20241113 } from "./op
22
import { ApiClient } from "./apiClient.js";
33
import { LogId } from "../logger.js";
44

5+
const DEFAULT_PORT = "27017";
56
export interface Cluster {
67
name?: string;
78
instanceType: "FREE" | "DEDICATED" | "FLEX";
@@ -103,14 +104,12 @@ export async function getProcessIdFromCluster(
103104
clusterName: string
104105
): Promise<string> {
105106
try {
106-
// Reuse existing inspectCluster method
107107
const cluster = await inspectCluster(apiClient, projectId, clusterName);
108108
if (!cluster.connectionString) {
109109
throw new Error("No connection string available for cluster");
110110
}
111-
// Extract host:port from connection string
112111
const url = new URL(cluster.connectionString);
113-
const processId = `${url.hostname}:${url.port || "27017"}`;
112+
const processId = `${url.hostname}:${url.port || DEFAULT_PORT}`;
114113
return processId;
115114
} catch (error) {
116115
throw new Error(

src/common/atlas/performanceAdvisorUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ export async function getSlowQueries(
192192
projectId: string,
193193
clusterName: string,
194194
since: string,
195-
processId?: string // Optional parameter for direct processId
195+
processId?: string
196196
): Promise<{ slowQueryLogs: Array<SlowQueryLog> }> {
197197
try {
198-
// If processId is not provided, try to get it from cluster info
198+
// If processId is not provided, get it from inspecting the cluster
199199
let actualProcessId = processId;
200200
if (!actualProcessId) {
201201
actualProcessId = await getProcessIdFromCluster(apiClient, projectId, clusterName);

0 commit comments

Comments
 (0)