Пример #1
0
 public void Refresh()
 {
     _scheduled  = _hangfire.ScheduledJobs(0, (int)_hangfire.ScheduledCount());
     _processing = _hangfire.ProcessingJobs(0, (int)_hangfire.ProcessingCount());
     _failed     = _hangfire.FailedJobs(0, (int)_hangfire.FailedCount());
     _succeded   = _hangfire.SucceededJobs(0, (int)_hangfire.SucceededListCount());
     _recurring  = JobStorage.Current.GetConnection().GetRecurringJobs();
 }
        private HangfireJob CreateJobCache()
        {
            if (_jobCache.HasJobs)
            {
                return(_jobCache);
            }
            //else

            _monitor.EnqueuedJobs("default", 0, int.MaxValue).Select(x => x.Value)
            .ForEach(x => _jobCache.AddJob(x, HangfireJob.QUEUED));
            _monitor.ScheduledJobs(0, int.MaxValue).Select(x => x.Value)
            .ForEach(x => _jobCache.AddJob(x, HangfireJob.QUEUED));
            _monitor.FailedJobs(0, int.MaxValue).Select(x => x.Value)
            .ForEach(x => _jobCache.AddJob(x, HangfireJob.FAILED));
            _monitor.SucceededJobs(0, int.MaxValue).Select(x => x.Value)
            .ForEach(x => _jobCache.AddJob(x, HangfireJob.SUCCEEDED));
            _monitor.ProcessingJobs(0, int.MaxValue).Select(x => x.Value)
            .ForEach(x => _jobCache.AddJob(x, HangfireJob.PROCESSING));
            return(_jobCache);
        }