Revert "Setup so that client regenerates when another endpoint is selected."

This reverts commit bbe4a755a0.
This commit is contained in:
Craig Boger (from Dev Box)
2024-02-16 17:46:02 -08:00
parent b45e667d51
commit fd8670ee9b
4 changed files with 27 additions and 41 deletions

View File

@@ -131,8 +131,6 @@ enum SDKSupportedCapabilities {
// Need to put in some kind of function here to recreate the CosmosClient with a new endpoint.
// changeClientEndpoint.......
// let _clients: Map<string, Cosmos.CosmosClient> = new Map();
let _client: Cosmos.CosmosClient;
export function client(): Cosmos.CosmosClient {
@@ -157,13 +155,6 @@ export function client(): Cosmos.CosmosClient {
});
}
const retrievedEndpoint = endpoint() || "https://cosmos.azure.com";
// if (_clients.has(retrievedEndpoint)) {
// console.log(`Current Client List: ${JSON.stringify(_clients)}`);
// return _clients.get(retrievedEndpoint);
// }
if (_client && currentUserContextDocumentEndpoint === mydatabaseAccountEndpoint) {
return _client;
}
@@ -185,7 +176,7 @@ export function client(): Cosmos.CosmosClient {
}
const options: Cosmos.CosmosClientOptions = {
endpoint: retrievedEndpoint, // CosmosClient gets upset if we pass a bad URL. This should never actually get called
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
key: userContext.masterKey,
tokenProvider,
userAgentSuffix: "Azure Portal",
@@ -229,11 +220,6 @@ export function client(): Cosmos.CosmosClient {
(options as any).plugins = plugins;
}
_client = null;
_client = new Cosmos.CosmosClient(options);
return _client;
// _clients.set(retrievedEndpoint, new Cosmos.CosmosClient(options));
// return _clients.get(retrievedEndpoint);
}