public async Task <IActionResult> Stop([FromQuery] Guid sid) { bool success = await QuartzManager.Stop(sid); if (success) { return(Ok()); } return(BadRequest()); }
public async Task Execute(IJobExecutionContext context) { using (var scope = new ScopeDbContext()) { var _db = scope.GetDbContext(); var stoppedList = _db.Schedules.Where(x => x.Status == (int)ScheduleStatus.Stop).Select(x => x.Id).ToList(); foreach (var sid in stoppedList) { JobKey jk = new JobKey(sid.ToString().ToLower()); if (await context.Scheduler.CheckExists(jk)) { await QuartzManager.Stop(sid); } } } }
public async Task Execute(IJobExecutionContext context) { using (var scope = new ScopeDbContext()) { var _db = scope.GetDbContext(); var stoppedList = (from s in _db.Schedules join n in _db.ScheduleExecutors on s.Id equals n.ScheduleId where s.Status == (int)ScheduleStatus.Stop && n.WorkerName == ConfigurationCache.NodeSetting.IdentityName select n.ScheduleId ).ToList(); foreach (var sid in stoppedList) { JobKey jk = new JobKey(sid.ToString().ToLower()); if (await context.Scheduler.CheckExists(jk)) { await QuartzManager.Stop(sid); } } } }
public async Task StopAsync(CancellationToken cancellationToken) { _logger.LogInformation("QuartzService stop"); await _quartzManager.Stop(); }