Exemplo n.º 1
0
        public async Task <IActionResult> Stop([FromQuery] Guid sid)
        {
            bool success = await QuartzManager.Stop(sid);

            if (success)
            {
                return(Ok());
            }
            return(BadRequest());
        }
Exemplo n.º 2
0
 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);
             }
         }
     }
 }
Exemplo n.º 3
0
 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);
             }
         }
     }
 }
Exemplo n.º 4
0
 public async Task StopAsync(CancellationToken cancellationToken)
 {
     _logger.LogInformation("QuartzService stop");
     await _quartzManager.Stop();
 }