Apply suggestions from code review
Co-authored-by: David Pine <david.pine@microsoft.com>
This commit is contained in:
parent
c819a8ce69
commit
fcd42510ff
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,9 @@ public class DefaultRabbitMQPersistentConnection
|
||||
|
||||
try
|
||||
{
|
||||
_connection.ConnectionShutdown -= OnConnectionShutdown;
|
||||
_connection.CallbackException -= OnCallbackException;
|
||||
_connection.ConnectionBlocked -= OnConnectionBlocked;
|
||||
_connection.Dispose();
|
||||
}
|
||||
catch (IOException ex)
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
namespace Basket.API.Infrastructure.Middlewares;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
public class FailingMiddleware
|
||||
|
Loading…
x
Reference in New Issue
Block a user