Changeset 472dd7e


Ignore:
Timestamp:
02/14/21 23:34:17 (17 months ago)
Author:
Dimitar Slezenkovski <dslezenkovski@…>
Branches:
master
Parents:
f554983
Message:

Fix cron job bug

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/Startup.cs

    rf554983 r472dd7e  
    122122            });*/
    123123
     124            services.AddScoped<UpdateDataJob>();
    124125            services.AddSingleton<IJobFactory, SingletonUpdateDataJobFactory>();
    125126            services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
    126127
    127             services.AddTransient<UpdateDataJob>();
    128128            services.AddSingleton(new JobSchedule(
    129129            jobType: typeof(UpdateDataJob),
  • FarmatikoServices/Services/SingletonUpdateDataJobFactory.cs

    rf554983 r472dd7e  
    1818        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
    1919        {
    20             return _serviceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
     20            using (var scope = _serviceProvider.CreateScope())
     21            {
     22                return scope.ServiceProvider.GetRequiredService(bundle.JobDetail.JobType) as IJob;
     23            }
     24           
    2125        }
    2226
Note: See TracChangeset for help on using the changeset viewer.