public void ScheduleTask(Guid id, string cronExpression, Func <CancellationToken, Task> func) { var expression = _cronParser.Parse(cronExpression); var scheduledTask = new ScheduledTask(id, expression, func); _scheduledTasks.Add(scheduledTask); }
public void ChangeSchedule <T>(string cronString) where T : ICronJob { Stop(); _cronExpression = _cronParser.Parse(cronString); Create <T>(); }
public JobHandler(Guid jobId, ICronJob cronJob, string cronExpression, IServiceScopeFactory serviceScopeFactory) { JobId = jobId; _cronJob = cronJob; _serviceScopeFactory = serviceScopeFactory; _cronParser = new CronParser(new CronDateTimeService()); _cronExpression = _cronParser.Parse(cronExpression); }