public QueueStatistics Stat() { var stat = new QueueStatistics(); stat.StatusCounts.Add(TaskStatus.Pending, _tasksByStatus[TaskStatus.Pending].Count); stat.StatusCounts.Add(TaskStatus.InProgress, _tasksByStatus[TaskStatus.InProgress].Count); stat.StatusCounts.Add(TaskStatus.Failed, _tasksByStatus[TaskStatus.Failed].Count); stat.StatusCounts.Add(TaskStatus.Aborted, _tasksByStatus[TaskStatus.Aborted].Count); stat.StatusCounts.Add(TaskStatus.Completed, _tasksByStatus[TaskStatus.Completed].Count); return stat; }
public QueueStatistics Stat() { var stat = new QueueStatistics(); using (var session = OpenSession()) { foreach (var value in Enum.GetValues(typeof(TaskStatus))) { var status = (TaskStatus)value; var count = Query(session).Where(t => t.Status == status).Count(); stat.StatusCounts.Add(status, count); } } return stat; }