Browse Source

Apply suggestions from code review

Co-authored-by: David Pine <david.pine@microsoft.com>
pull/1770/head
Sumit Ghosh 3 years ago
committed by GitHub
parent
commit
fcd42510ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 16 deletions
  1. +1
    -1
      src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs
  2. +1
    -1
      src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs
  3. +5
    -8
      src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs
  4. +3
    -0
      src/BuildingBlocks/EventBus/EventBusRabbitMQ/DefaultRabbitMQPersistentConnection.cs
  5. +1
    -1
      src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs
  6. +3
    -3
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs
  7. +1
    -2
      src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs
  8. +1
    -0
      src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs

+ 1
- 1
src/ApiGateways/Web.Bff.Shopping/aggregator/Services/OrderApiClient.cs 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);


+ 1
- 1
src/BuildingBlocks/EventBus/EventBus/InMemoryEventBusSubscriptionsManager.cs 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)


+ 5
- 8
src/BuildingBlocks/EventBus/EventBus/SubscriptionInfo.cs 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);
}
}

+ 3
- 0
src/BuildingBlocks/EventBus/EventBusRabbitMQ/DefaultRabbitMQPersistentConnection.cs View File

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


+ 1
- 1
src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs 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))


+ 3
- 3
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs 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;
}
}


+ 1
- 2
src/BuildingBlocks/EventBus/IntegrationEventLogEF/Utilities/ResilientTransaction.cs 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)
{


+ 1
- 0
src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs View File

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


Loading…
Cancel
Save