Permalink
Browse files

Fix bug with redis connection handling.

Previously, it was just using the default connection
of `localhost:6379`, regardless if you setup your
app with an `Ost.connect`.

With this change, the redis object is passed properly
to the constructor of the Queue object.

credits: thanks to @conanbatt for spotting this.
  • Loading branch information...
1 parent 2113eb1 commit 67c8e509f9e17157c323acc1c35db393d30c4803 @cyx cyx committed Nov 28, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/ost.rb
  2. +6 −0 test/ost_test.rb
View
@@ -9,7 +9,7 @@ class Queue
attr :backup
def initialize(name)
- @key = Nest.new(:ost)[name]
+ @key = Nest.new(:ost, redis)[name]
@backup = @key[Socket.gethostname][Process.pid]
end
View
@@ -129,4 +129,10 @@ def enqueue(id)
assert_equal 0, Ost[:events].backup.llen
assert_equal false, Ost[:events].backup.exists
end
+
+ test "uses same redis instance" do
+ queue = Ost['foo']
+
+ assert_equal queue.key.redis, queue.redis
+ end
end

0 comments on commit 67c8e50

Please sign in to comment.