public PlataformaWorker(ILogger <PlataformaWorker> logger, IServiceProvider serviceProvider, IOptionsMonitor <AppSettings> appSettings, DbConnectionFactory dbConnectionFactory, WorkerConfiguration workerConfiguration, IConfiguration _config) : base(logger, serviceProvider, MutexName, workerConfiguration) { this.logger = logger; this.serviceProvider = serviceProvider; this.appSettings = appSettings; this.dbConnectionFactory = dbConnectionFactory; this.ElapsedTime += _timer_Elapsed; this._config = _config; }
public WorkerBase(ILogger <T> logger, IServiceProvider serviceProvider, string mutexName, WorkerConfiguration workerConfiguration) { mutex = new Mutex(false, mutexName); this.serviceProvider = serviceProvider; this.customInterval = workerConfiguration?.WorkerConfigs?.FirstOrDefault(x => x.WorkerName == mutexName)?.Interval; if (customInterval == null) { _interval = GetInterval(); } else { _interval = Convert.ToInt32(customInterval); } var disabled = workerConfiguration?.WorkerConfigs?.FirstOrDefault(x => x.WorkerName == mutexName)?.Disabled; if (disabled != null) { this.disabled = (bool)disabled; } CreateTimer(); }