Skip to content

Commit

Permalink
Make sure job DI scope is disposed
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Oct 14, 2024
1 parent 0800eb6 commit f0faf4e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public async Task StartAsync(CancellationToken cancellationToken = default)
try
{
using var activity = FoundatioDiagnostics.ActivitySource.StartActivity("Job " + Options.Name, ActivityKind.Server);
var scope = _serviceProvider.CreateScope();
await using var scope = _serviceProvider.CreateAsyncScope();
var job = Options.JobFactory(scope.ServiceProvider);
var result = await job.TryRunAsync(cancellationToken).AnyContext();
Expand Down

0 comments on commit f0faf4e

Please sign in to comment.