Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankowitz committed Sep 3, 2024
1 parent 92e84ec commit dec47bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,13 @@ private async Task InitializeDataStoreAsync(
await collectionSetup.CreateCollectionAsync(collectionInitializers, retryPolicyFactory.RetryPolicy, cancellationTokenSource.Token);
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error while checking if Cosmos setup is required.");
}

// When the collection exists we can start a distributed lock to ensure only one instance of the service does the rest of the setup
ICosmosDbDistributedLock setupLock = _distributedLockFactory.Create(_container.Value, nameof(InitializeDataStoreAsync));

await setupLock.AcquireLock(cancellationTokenSource.Token);
try
{
await setupLock.AcquireLock(cancellationTokenSource.Token);

if (cosmosDataStoreConfiguration.AllowCollectionSetup)
{
await collectionSetup.InstallStoredProcs(cancellationTokenSource.Token);
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.Health.Fhir.Shared.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@
"CosmosDb": {
"Host": null,
"Key": null,
"UseManagedIdentity": false,
"UseManagedIdentity": false, // False for localhost/emulator
"AllowDatabaseCreation": true,
"AllowCollectionSetup": true,
"DatabaseId": "health",
"InitialDatabaseThroughput": null,
"ConnectionMode": "Direct",
Expand Down

0 comments on commit dec47bc

Please sign in to comment.