lib/couchpillow/directives/multi_db.rb in couchpillow-0.4.6 vs lib/couchpillow/directives/multi_db.rb in couchpillow-0.4.7

- old
+ new

@@ -1,9 +1,5 @@ -require 'celluloid/autostart' - -Celluloid.logger = nil - module CouchPillow module MultiDBDirective # Set a DB connection. Overrides the default CouchPillow.db connection @@ -36,30 +32,30 @@ end def _write_to_secondary_dbs &block unless _secondary_dbs.empty? - _futures << Celluloid::Future.new do + _threads << Thread.new do _secondary_dbs.each do |db| block.call(db) end end end end - def _futures - @futures ||= [] + def _threads + @threads ||= [] end # Blocks until all pending tasks has completed. # Returns the result of those tasks in an array. # def wait result = [] - until _futures.empty? - f = _futures.shift + until _threads.empty? + f = _threads.shift result << f.value end result end