fix async/await warnings
This commit is contained in:
parent
fc79c43c1e
commit
5c60b6ace7
@ -1,14 +1,14 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using HealthChecks.UI.Client;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
using Ocelot.DependencyInjection;
|
using Ocelot.DependencyInjection;
|
||||||
using Ocelot.Middleware;
|
using Ocelot.Middleware;
|
||||||
using System;
|
using System;
|
||||||
using HealthChecks.UI.Client;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
||||||
|
|
||||||
namespace OcelotApiGw
|
namespace OcelotApiGw
|
||||||
{
|
{
|
||||||
@ -17,9 +17,7 @@ namespace OcelotApiGw
|
|||||||
private readonly IConfiguration _cfg;
|
private readonly IConfiguration _cfg;
|
||||||
|
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
=> _cfg = configuration;
|
||||||
_cfg = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
@ -59,16 +57,22 @@ namespace OcelotApiGw
|
|||||||
{
|
{
|
||||||
OnAuthenticationFailed = async ctx =>
|
OnAuthenticationFailed = async ctx =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
});
|
||||||
},
|
},
|
||||||
OnTokenValidated = async ctx =>
|
OnTokenValidated = async ctx =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
OnMessageReceived = async ctx =>
|
OnMessageReceived = async ctx =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using HealthChecks.UI.Client;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
using System.Net.Http;
|
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -13,22 +11,23 @@ using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure;
|
|||||||
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services;
|
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Polly;
|
using Polly;
|
||||||
using Polly.Extensions.Http;
|
using Polly.Extensions.Http;
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
using HealthChecks.UI.Client;
|
using System;
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
=> Configuration = configuration;
|
||||||
Configuration = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
@ -168,9 +167,11 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
|||||||
{
|
{
|
||||||
OnAuthenticationFailed = async ctx =>
|
OnAuthenticationFailed = async ctx =>
|
||||||
{
|
{
|
||||||
|
await Task.Run(() => { });
|
||||||
},
|
},
|
||||||
OnTokenValidated = async ctx =>
|
OnTokenValidated = async ctx =>
|
||||||
{
|
{
|
||||||
|
await Task.Run(() => { });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -202,18 +203,14 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy()
|
private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy()
|
||||||
{
|
=> HttpPolicyExtensions
|
||||||
return HttpPolicyExtensions
|
|
||||||
.HandleTransientHttpError()
|
.HandleTransientHttpError()
|
||||||
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
|
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||||
.WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
|
.WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
|
||||||
}
|
|
||||||
|
|
||||||
private static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy()
|
private static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy()
|
||||||
{
|
=> HttpPolicyExtensions
|
||||||
return HttpPolicyExtensions
|
|
||||||
.HandleTransientHttpError()
|
.HandleTransientHttpError()
|
||||||
.CircuitBreakerAsync(5, TimeSpan.FromSeconds(30));
|
.CircuitBreakerAsync(5, TimeSpan.FromSeconds(30));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using HealthChecks.UI.Client;
|
||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -9,27 +11,23 @@ using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Infrastructure;
|
|||||||
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
|
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Polly;
|
using Polly;
|
||||||
using Polly.Extensions.Http;
|
using Polly.Extensions.Http;
|
||||||
using Polly.Timeout;
|
|
||||||
using Swashbuckle.AspNetCore.Swagger;
|
using Swashbuckle.AspNetCore.Swagger;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using HealthChecks.UI.Client;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
=> Configuration = configuration;
|
||||||
Configuration = configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
@ -117,11 +115,15 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
|||||||
{
|
{
|
||||||
OnAuthenticationFailed = async ctx =>
|
OnAuthenticationFailed = async ctx =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
});
|
||||||
},
|
},
|
||||||
OnTokenValidated = async ctx =>
|
OnTokenValidated = async ctx =>
|
||||||
{
|
{
|
||||||
int i = 0;
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -201,20 +203,15 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
|
|||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy()
|
private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy()
|
||||||
{
|
=> HttpPolicyExtensions
|
||||||
return HttpPolicyExtensions
|
|
||||||
.HandleTransientHttpError()
|
.HandleTransientHttpError()
|
||||||
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
|
.OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||||
.WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
|
.WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
|
||||||
|
|
||||||
}
|
private static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy()
|
||||||
|
=> HttpPolicyExtensions
|
||||||
static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy()
|
|
||||||
{
|
|
||||||
return HttpPolicyExtensions
|
|
||||||
.HandleTransientHttpError()
|
.HandleTransientHttpError()
|
||||||
.CircuitBreakerAsync(5, TimeSpan.FromSeconds(30));
|
.CircuitBreakerAsync(5, TimeSpan.FromSeconds(30));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Webhooks.API.IntegrationEvents
|
namespace Webhooks.API.IntegrationEvents
|
||||||
@ -9,8 +6,6 @@ namespace Webhooks.API.IntegrationEvents
|
|||||||
public class ProductPriceChangedIntegrationEventHandler : IIntegrationEventHandler<ProductPriceChangedIntegrationEvent>
|
public class ProductPriceChangedIntegrationEventHandler : IIntegrationEventHandler<ProductPriceChangedIntegrationEvent>
|
||||||
{
|
{
|
||||||
public async Task Handle(ProductPriceChangedIntegrationEvent @event)
|
public async Task Handle(ProductPriceChangedIntegrationEvent @event)
|
||||||
{
|
=> await Task.Run(() => { });
|
||||||
int i = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user