Skip to content

Commit

Permalink
Modified HostedServices to run in seperate threads.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simnico99 committed Oct 13, 2022
1 parent 8a37709 commit 909e8fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static IHostBuilder UseBackgroundServices(this IHostBuilder builder)
{
if (service is IHostedService hostedService)
{
hostedService.StartAsync(_cts.Token);
Task.Run(async () => await hostedService.StartAsync(_cts.Token));
_runningHostedServices.Add(hostedService);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static IHostBuilder UseBackgroundServices(this IHostBuilder builder)
{
if (service is IHostedService hostedService)
{
hostedService.StartAsync(_cts.Token);
Task.Run(async () => await hostedService.StartAsync(_cts.Token));
_runningHostedServices.Add(hostedService);
}
}
Expand Down

0 comments on commit 909e8fc

Please sign in to comment.