Replace couchbase counters with drb version
This commit is contained in:
@@ -5,13 +5,20 @@ module Qwaiter
|
||||
end
|
||||
|
||||
def self.load_design_docs!
|
||||
return unless connection.present?
|
||||
Dir.glob(Rails.root.join('config/couchbase/design_docs', "*.json")).each do |design_doc|
|
||||
connection.save_design_doc File.open(design_doc)
|
||||
end
|
||||
end
|
||||
|
||||
def self.design_doc(name)
|
||||
return unless connection.present?
|
||||
connection.design_docs[name]
|
||||
end
|
||||
|
||||
def self.flush_counters!
|
||||
return unless connection.present?
|
||||
design_doc('supplier').counters(reduce: false).each{|counter| Qwaiter::Counter.set counter.key, 0}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,8 +22,3 @@ module Qwaiter
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# use the connection from couchbase-structures/documents
|
||||
# will be overwritten in the specs since flushing the real
|
||||
# thing is difficult
|
||||
Qwaiter::Counter.connection = $cb unless Rails.env.test?
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
module Qwaiter
|
||||
module DrbCounter
|
||||
def self.object
|
||||
require 'drb'
|
||||
DRbObject.new_with_uri('druby://localhost:9022')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user