Permalink
Browse files

trying to fix the connection opening flood...

  • Loading branch information...
1 parent 41b2a8c commit 09b7bc1748655a1e0d362e8b185bcf32087e8c6d @nofxx committed Jul 18, 2009
Showing with 11 additions and 4 deletions.
  1. +1 −1 VERSION
  2. +8 −1 lib/rack/session/tokyo.rb
  3. +2 −2 tokyo_store.gemspec
View
@@ -1 +1 @@
-0.2.0
+0.2.1
@@ -8,7 +8,10 @@ def initialize(app, options = {})
super
@mutex = Mutex.new
@host, @port = *(options[:tyrant_server] || @default_options[:tyrant_server]).split(":") # @default_options) #options[:cache] ||
- tokyo_connect
+ # connecting & closing on each get and put
+ # not sure if this is the best option, but otherwise it'll keep
+ # opening connections until tyrant freezes... =/
+ # tokyo_connect
end
private
@@ -21,6 +24,7 @@ def tokyo_connect
end
def get_session(env, sid)
+ tokyo_connect
@mutex.lock if env['rack.multithread']
session = Marshal.load(@pool[sid]) rescue session if sid && session = @pool[sid]
unless sid && session
@@ -36,9 +40,11 @@ def get_session(env, sid)
session = {}
ensure
@mutex.unlock if env['rack.multithread']
+ @pool.close
end
def set_session(env, sid, new_session, options)
+ tokyo_connect
@mutex.lock if env['rack.multithread']
session = Marshal.load(session) rescue session if session = @pool[sid]
if options[:renew] || options[:drop]
@@ -56,6 +62,7 @@ def set_session(env, sid, new_session, options)
warn $!.inspect
ensure
@mutex.unlock if env['rack.multithread']
+ @pool.close
end
def generate_sid
View
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{tokyo_store}
- s.version = "0.2.0"
+ s.version = "0.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marcos Piccinini"]
- s.date = %q{2009-07-06}
+ s.date = %q{2009-07-18}
s.email = %q{x@nofxx.com}
s.extra_rdoc_files = [
"LICENSE",

0 comments on commit 09b7bc1

Please sign in to comment.