Skip to content

Commit

Permalink
feat: Remove the Blob Container creation check as it was taking ~10s …
Browse files Browse the repository at this point in the history
…to execute (#450)
  • Loading branch information
killij authored Feb 29, 2024
1 parent c7e3f09 commit 40c9b83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
builder.AddDependencies();
Console.WriteLine($"After AddDependencies {sw.ElapsedMilliseconds}ms");

await builder.AddFeatures(sw);
builder.AddFeatures(sw);
Console.WriteLine($"After AddFeatures {sw.ElapsedMilliseconds}ms");

var app = builder.Build();
Expand Down
11 changes: 3 additions & 8 deletions Childrens-Social-Care-CPD/WebApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static void AddSearch(IServiceCollection services)
services.AddScoped<ISearchService, SearchService>();
}

public static async Task AddFeatures(this WebApplicationBuilder builder, Stopwatch sw)
public static void AddFeatures(this WebApplicationBuilder builder, Stopwatch sw)
{
ArgumentNullException.ThrowIfNull(builder);

Expand Down Expand Up @@ -123,7 +123,7 @@ public static async Task AddFeatures(this WebApplicationBuilder builder, Stopwat
AddHealthChecks(builder.Services);
Console.WriteLine($"After AddHealthChecks: {sw.ElapsedMilliseconds}ms");

await AddDataProtection(builder.Services, applicationConfiguration, sw);
AddDataProtection(builder.Services, applicationConfiguration, sw);
Console.WriteLine($"After AddDataProtection: {sw.ElapsedMilliseconds}ms");
}

Expand Down Expand Up @@ -176,7 +176,7 @@ private static void AddHealthChecks(IServiceCollection services)
#pragma warning restore CA1861 // Avoid constant arrays as arguments
}

private static async Task AddDataProtection(IServiceCollection services, ApplicationConfiguration applicationConfiguration, Stopwatch sw)
private static void AddDataProtection(IServiceCollection services, ApplicationConfiguration applicationConfiguration, Stopwatch sw)
{
if (!string.IsNullOrEmpty(applicationConfiguration.AzureDataProtectionContainerName))
{
Expand All @@ -187,11 +187,6 @@ private static async Task AddDataProtection(IServiceCollection services, Applica
var managedIdentityCredential = new ManagedIdentityCredential(clientId: applicationConfiguration.AzureManagedIdentityId);
Console.WriteLine($"After AddDataProtection:new ManagedIdentityCredential: {sw.ElapsedMilliseconds}ms");

var blobContainerUri = new Uri(url);
var blobContainerClient = new BlobContainerClient(blobContainerUri, managedIdentityCredential);
await blobContainerClient.CreateIfNotExistsAsync();
Console.WriteLine($"After AddDataProtection:blobContainerClient.CreateIfNotExistsAsync: {sw.ElapsedMilliseconds}ms");

var blobUri = new Uri($"{url}/data-protection");
services
.AddDataProtection()
Expand Down

0 comments on commit 40c9b83

Please sign in to comment.