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 TResult GetResult <TResult>(string jobId) { var total = (int)monitoringApi.SucceededListCount(); var numberOfJobs = 10; for (var i = 0; i < total; i += numberOfJobs) { var start = Math.Max(total - i - numberOfJobs, 0); var end = total - i; var count = end - start; var job = monitoringApi.SucceededJobs(start, count).SingleOrDefault(x => x.Key == jobId).Value; if (job != null) { var result = job.Result; if (result.GetType() == typeof(string)) { return(JsonConvert.DeserializeObject <TResult>((string)result)); } return((TResult)job.Result); } } throw new InvalidOperationException("Failed to find job"); }