Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure client is alive on Rack store.

  • Loading branch information...
commit 13cef1f868e35554ed4c20a9e780dc76b6e26e7c 1 parent 99c62c4
@arthurnn arthurnn authored
View
6 lib/dalli/client.rb
@@ -213,6 +213,12 @@ def reset_stats
end
##
+ ## Make sure memcache servers are alive, or raise an Dalli::RingError
+ def alive!
+ ring.server_for_key("")
+ end
+
+ ##
## Version of the memcache servers.
def version
values = {}
View
1  lib/rack/session/dalli.rb
@@ -16,6 +16,7 @@ def initialize(app, options={})
mserv = @default_options[:memcache_server]
mopts = @default_options.reject{|k,v| !DEFAULT_OPTIONS.include? k }
@pool = options[:cache] || ::Dalli::Client.new(mserv, mopts)
+ @pool.alive!
end
def generate_sid
View
3  test/test_rack_session.rb
@@ -55,8 +55,7 @@
it "faults on no connection" do
assert_raises Dalli::RingError do
- rsd = Rack::Session::Dalli.new(incrementor, :memcache_server => 'nosuchserver')
- rsd.pool.set('ping', '')
+ Rack::Session::Dalli.new(incrementor, :memcache_server => 'nosuchserver')
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.