lib/rocket_job/sliced/input.rb
def next_slice(worker_name)
        # TODO: Will it perform faster without the id sort?
        # I.e. Just process on a FIFO basis?
        document                 = all.queued.
          sort('_id' => 1).
          find_one_and_update(
            {'$set' => {worker_name: worker_name, state: :running, started_at: Time.now}},
            return_document: :after
          )
        document.collection_name = collection_name if document
        document
      end
# Returns the next slice to work on in id order
# Returns nil if there are currently no queued slices
#
# If a slice is in queued state it will be started and assigned to this worker
Returns the next slice to work on in id order
Returns nil if there are currently no queued slices

If a slice is in queued state it will be started and assigned to this worker
Returns the next slice to work on in id order Returns nil if there are currently no queued slices If a slice is in queued state it will be started and assigned to this worker
def next_slice(worker_name)
        document                 = all.queued.
          sort('_id' => 1).
          find_one_and_update(
            {'$set' => {worker_name: worker_name, state: :running, started_at: Time.now}},
            return_document: :after
          )
        document.collection_name = collection_name if document
        document
      end
def next_slice ( worker_name ) document = all . queued . sort ( '_id' => 1 ) . find_one_and_update ( { '$set' => { worker_name : worker_name , state : :running , started_at : Time . now } } , return_document : :after ) document . collection_name = collection_name if document document end
Returns the next slice to work on in id order
Returns nil if there are currently no queued slices
Returns the next slice to work on in id order Returns nil if there are currently no queued slices
# TODO: Will it perform faster without the id sort? # I.e. Just process on a FIFO basis?
worker_name