Browse Source

Update Redis to not resolve DNS at startup

pull/1776/head
Aaron Crawfis 3 years ago
committed by GitHub
parent
commit
a94e9c464a
1 changed files with 1 additions and 7 deletions
  1. +1
    -7
      src/Services/Basket/Basket.API/Startup.cs

+ 1
- 7
src/Services/Basket/Basket.API/Startup.cs View File

@ -101,18 +101,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.Configure<BasketSettings>(Configuration);
//By connecting here we are making sure that our service
//cannot start until redis is ready. This might slow down startup,
//but given that there is a delay on resolving the ip address
//and then creating the connection it seems reasonable to move
//that cost to startup instead of having the first request pay the
//penalty.
//cannot start until redis is ready.
services.AddSingleton<ConnectionMultiplexer>(sp =>
{
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
configuration.ResolveDns = true;
return ConnectionMultiplexer.Connect(configuration);
});


Loading…
Cancel
Save