Skip to content

Commit

Permalink
refactor: extract event handler body to private method
Browse files Browse the repository at this point in the history
  • Loading branch information
Dannyps committed Oct 17, 2023
1 parent 38215d7 commit 312a1b9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ public TierQuotaDefinitionDeletedIntegrationEventHandler(IIdentitiesRepository i
public async Task Handle(TierQuotaDefinitionDeletedIntegrationEvent @event)
{
_logger.LogTrace("Handling '{eventName}' ... ", nameof(TierQuotaDefinitionDeletedIntegrationEvent));
await RecalculateMetricStatuses(@event);
}

private async Task RecalculateMetricStatuses(TierQuotaDefinitionDeletedIntegrationEvent @event)
{
var identitiesWithTier = await _identitiesRepository.FindWithTier(new TierId(@event.TierId), CancellationToken.None);

await _metricStatusesService.RecalculateMetricStatuses(
identitiesWithTier.Select(i => i.Address).ToList(),
MetricKey.GetSupportedMetricKeyValues().ToList(),
CancellationToken.None
);

_logger.LogTrace("Successfully deleted quotas for Identities.");
}
}

0 comments on commit 312a1b9

Please sign in to comment.