lib/seam/mongodb.rb in seam-mongodb-0.0.5 vs lib/seam/mongodb.rb in seam-mongodb-1.0.0
- old
+ new
@@ -23,11 +23,14 @@
Seam::Effort.parse document
end
def self.find_all_pending_executions_by_step step
Seam::Mongodb.collection
- .find( { next_step: step, next_execute_at: { '$lte' => Time.now } } )
+ .find( {
+ next_step: step,
+ next_execute_at: { '$lte' => Time.now }
+ } )
.select( { '_id' => 1 } )
.map do |x|
-> do
record = Seam::Mongodb.collection.find( { '_id' => x['_id'] } ).first
Seam::Effort.parse record
@@ -37,11 +40,11 @@
def self.find_something_to_do
record = Seam::Mongodb.collection
.find( {
next_execute_at: { '$lte' => Time.now },
- next_step: { '$ne' => nil },
- complete: { '$in' => [nil, false] },
+ next_step: { '$ne' => nil },
+ complete: { '$in' => [nil, false] },
} )
.first
return [] unless record
[record].map do |x|
-> do