From 0f0bdaea7bf46c316ee63a9a66c8668354f142f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 29 Jul 2010 09:10:01 +0200 Subject: Revert "Avoid uneeded queries in session stores if sid is not given." First step to merge Rails and Rack session stores. Rack always expects to receive the SID since it may have different behavior if the SID is nil. This reverts commit e210895ba95e498b9debbf43a3e5ae588bca81f0. --- .../lib/action_dispatch/middleware/session/abstract_store.rb | 7 ++----- .../lib/action_dispatch/middleware/session/mem_cache_store.rb | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb index ad98249468..dd82294644 100644 --- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb @@ -191,11 +191,8 @@ module ActionDispatch def load_session(env) stale_session_check! do - if sid = current_session_id(env) - sid, session = get_session(env, sid) - else - sid, session = generate_sid, {} - end + sid = current_session_id(env) + sid, session = get_session(env, sid) [sid, session] end end diff --git a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb index 5304440418..28e3dbd732 100644 --- a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb @@ -25,6 +25,7 @@ module ActionDispatch private def get_session(env, sid) + sid ||= generate_sid begin session = @pool.get(sid) || {} rescue MemCache::MemCacheError, Errno::ECONNREFUSED -- cgit v1.2.3