1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-02 18:47:44 +01:00

Updated quartz jobs to create a container scope to allow for scoped services (#5131)

This commit is contained in:
Conner Turnbull 2024-12-09 14:56:12 -05:00 committed by GitHub
parent c591997d01
commit 2212f552aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
using Quartz; using Microsoft.Extensions.DependencyInjection;
using Quartz;
using Quartz.Spi; using Quartz.Spi;
namespace Bit.Core.Jobs; namespace Bit.Core.Jobs;
@ -14,7 +15,8 @@ public class JobFactory : IJobFactory
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{ {
return _container.GetService(bundle.JobDetail.JobType) as IJob; var scope = _container.CreateScope();
return scope.ServiceProvider.GetService(bundle.JobDetail.JobType) as IJob;
} }
public void ReturnJob(IJob job) public void ReturnJob(IJob job)