lib/hotseat/queue.rb in hotseat-0.1.1 vs lib/hotseat/queue.rb in hotseat-0.1.2
- old
+ new
@@ -52,11 +52,14 @@
@db.save_doc Hotseat.design_doc
end
end
def add(doc_id)
- @db.update_doc(doc_id) {|doc| Queue.patch doc }
+ @db.update_doc(doc_id) do |doc|
+ Queue.patch doc
+ yield doc if block_given?
+ end
end
def add_bulk(doc_ids)
#Note: this silently ignores missing doc_ids
docs = @db.bulk_load(doc_ids)['rows'].map{|row| row['doc']}.compact
@@ -99,10 +102,11 @@
if opts.delete(:forget)
Queue.unpatch doc
else
Queue.mark_done( Queue.remove_lock( doc ) )
end
+ yield doc if block_given?
end
end
def remove_bulk(doc_ids, opts={})
rows = @db.bulk_load(doc_ids)['rows']
@@ -152,6 +156,6 @@
docs.each{|doc| Queue.unpatch doc }
@db.bulk_save docs, use_uuids=false
end
end
-end
\ No newline at end of file
+end