lib/rocket_job/plugins/job/persistence.rb in rocketjob-3.3.1 vs lib/rocket_job/plugins/job/persistence.rb in rocketjob-3.3.2
- old
+ new
@@ -68,17 +68,18 @@
# :running => 25,
# :completed => 1237
# }
def counts_by_state
counts = {}
- collection.aggregate([
- {
- '$group' => {
- _id: '$state',
- count: {'$sum' => 1}
+ collection.aggregate(
+ [
+ {
+ '$group' => {
+ _id: '$state',
+ count: {'$sum' => 1}
+ }
}
- }
- ]
+ ]
).each do |result|
counts[result['_id'].to_sym] = result['count']
end
# Calculate :queued_now and :scheduled if there are queued jobs