lib/hotseat/queue.rb in hotseat-0.6.0 vs lib/hotseat/queue.rb in hotseat-0.7.0

- old
+ new

@@ -124,10 +124,15 @@ docs = @db.bulk_load(doc_ids)['rows'].map{|row| row['doc']}.compact docs.each {|doc| patch doc } @db.bulk_save docs, use_uuids=false end + def create_and_add_bulk(docs) + docs.each {|doc| patch doc } + @db.bulk_save docs + end + def num_pending @db.view(pending_view_name, :limit => 0)['total_rows'] end alias :size :num_pending @@ -175,9 +180,14 @@ @db.bulk_save locked, use_uuids=false {'errors' => unlocked.map {|doc| {'id' => doc['_id'], 'error' => 'unlocked' } } + missing.map {|row| {'id' => row['key'], 'error' => row['error']} } } + end + + def unlease_all + doc_ids = db.view(locked_view_name)['rows'].map {|doc| doc['id'] } + unlease_bulk doc_ids end def remove(doc_id, opts={}) @db.update_doc(doc_id) do |doc| raise(QueueError, "Document was already removed") unless locked?(doc)