Apply suggestions from code review

Co-authored-by: David Pine <david.pine@microsoft.com>
This commit is contained in:
Sumit Ghosh 2021-10-20 17:27:14 +05:30 committed by GitHub
parent c819a8ce69
commit fcd42510ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 16 deletions

View File

@ -15,7 +15,7 @@ public class OrderApiClient : IOrderApiClient
public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket)
{
var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var url = $"{_urls.Orders}{UrlsConfig.OrdersOperations.GetOrderDraft()}";
var content = new StringContent(JsonSerializer.Serialize(basket), System.Text.Encoding.UTF8, "application/json");
var response = await _apiClient.PostAsync(url, content);

View File

@ -15,7 +15,7 @@ public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptio
_eventTypes = new List<Type>();
}
public bool IsEmpty => !_handlers.Keys.Any();
public bool IsEmpty => _handlers is { Count: 0 };
public void Clear() => _handlers.Clear();
public void AddDynamicSubscription<TH>(string eventName)

View File

@ -13,13 +13,10 @@ public partial class InMemoryEventBusSubscriptionsManager : IEventBusSubscriptio
HandlerType = handlerType;
}
public static SubscriptionInfo Dynamic(Type handlerType)
{
return new SubscriptionInfo(true, handlerType);
}
public static SubscriptionInfo Typed(Type handlerType)
{
return new SubscriptionInfo(false, handlerType);
}
public static SubscriptionInfo Dynamic(Type handlerType) =>
new SubscriptionInfo(true, handlerType);
public static SubscriptionInfo Typed(Type handlerType) =>
new SubscriptionInfo(false, handlerType);
}
}

View File

@ -44,6 +44,9 @@ public class DefaultRabbitMQPersistentConnection
try
{
_connection.ConnectionShutdown -= OnConnectionShutdown;
_connection.CallbackException -= OnCallbackException;
_connection.ConnectionBlocked -= OnConnectionBlocked;
_connection.Dispose();
}
catch (IOException ex)

View File

@ -139,7 +139,7 @@ public class EventBusServiceBus : IEventBus
return Task.CompletedTask;
}
private async Task<bool> ProcessEvent(string eventName, string message)
private async Task<bool> ProcessEventAsync(string eventName, string message)
{
var processed = false;
if (_subsManager.HasSubscriptionsForEvent(eventName))

View File

@ -5,7 +5,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService, IDisposab
private readonly IntegrationEventLogContext _integrationEventLogContext;
private readonly DbConnection _dbConnection;
private readonly List<Type> _eventTypes;
private volatile bool disposedValue;
private volatile bool _disposedValue;
public IntegrationEventLogService(DbConnection dbConnection)
{
@ -79,7 +79,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService, IDisposab
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
if (!_disposedValue)
{
if (disposing)
{
@ -87,7 +87,7 @@ public class IntegrationEventLogService : IIntegrationEventLogService, IDisposab
}
disposedValue = true;
_disposedValue = true;
}
}

View File

@ -6,8 +6,7 @@ public class ResilientTransaction
private ResilientTransaction(DbContext context) =>
_context = context ?? throw new ArgumentNullException(nameof(context));
public static ResilientTransaction New(DbContext context) =>
new ResilientTransaction(context);
public static ResilientTransaction New(DbContext context) => new(context);
public async Task ExecuteAsync(Func<Task> action)
{

View File

@ -1,4 +1,5 @@
namespace Basket.API.Infrastructure.Middlewares;
using Microsoft.Extensions.Logging;
public class FailingMiddleware