Skip to content

Commit

Permalink
Remove CompositeHostedService.
Browse files Browse the repository at this point in the history
  • Loading branch information
ifgris committed Jan 23, 2024
1 parent 4530e85 commit c3cb07d
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions Src/NanoRabbit/DependencyInjection/RabbitSubscriberExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,3 @@ public static IServiceCollection AddRabbitAsyncSubscriber<TAsyncSubscriber>(this
return services;
}
}

public class CompositeHostedService : IHostedService
{
private readonly List<IHostedService> _hostedServices;

public CompositeHostedService(List<IHostedService> hostedServices)
{
_hostedServices = hostedServices;
}

public async Task StartAsync(CancellationToken cancellationToken)
{
var tasks = _hostedServices.Select(service => service.StartAsync(cancellationToken));
await Task.WhenAll(tasks);
}

public async Task StopAsync(CancellationToken cancellationToken)
{
var tasks = _hostedServices.Select(service => service.StopAsync(cancellationToken));
await Task.WhenAll(tasks);
}
}

0 comments on commit c3cb07d

Please sign in to comment.