Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/documentdb/ClustersClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ export class ClustersClient {

try {
await this._mongoClient.connect();

// Remove the abort listener immediately after connect() resolves so that
// a late cancellation during synchronous API init below cannot close an
// already-connected client while the method continues as "successful".
abortSignal?.removeEventListener('abort', onAbort);

Comment thread
tnaum-ms marked this conversation as resolved.
Comment thread
tnaum-ms marked this conversation as resolved.
this._llmEnhancedFeatureApis = new llmEnhancedFeatureApis(this._mongoClient);
this._queryInsightsApis = new QueryInsightsApis(this._mongoClient);
} catch (error) {
Expand Down Expand Up @@ -341,6 +347,10 @@ export class ClustersClient {

try {
// if the client is already connected, it's a NOOP.
// Note: connectionCorrelationId retains the value from the initial
// connection (set in initClient). This is by design — the correlation
// ID links the original connect/staticmetadata/getmetadata events.
// Cached reconnects don't emit new metadata events, so no new ID is needed.
await client._mongoClient.connect();
} catch (error) {
if (abortSignal?.aborted) {
Expand Down
2 changes: 2 additions & 0 deletions src/tree/documentdb/ClusterItemBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ export abstract class ClusterItemBase<T extends BaseClusterModel = BaseClusterMo

void callWithTelemetryAndErrorHandling('connect', (context) => {
context.telemetry.properties.connectionResult = 'cancelled';
context.telemetry.properties.source = 'treeExpansion';
context.telemetry.properties.experience = this.experience.api;
throw error;
});

Expand Down
Loading