Skip to content

Commit

Permalink
Revert "Avoid uneeded queries in session stores if sid is not given."
Browse files Browse the repository at this point in the history
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 e210895.
  • Loading branch information
josevalim committed Jul 29, 2010
1 parent d69949e commit 0f0bdae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Expand Up @@ -191,11 +191,8 @@ def set_cookie(request, options)

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
Expand Down
Expand Up @@ -25,6 +25,7 @@ def initialize(app, options = {})

private
def get_session(env, sid)
sid ||= generate_sid
begin
session = @pool.get(sid) || {}
rescue MemCache::MemCacheError, Errno::ECONNREFUSED
Expand Down
1 change: 1 addition & 0 deletions activerecord/lib/active_record/session_store.rb
Expand Up @@ -293,6 +293,7 @@ def destroy
private
def get_session(env, sid)
Base.silence do
sid ||= generate_sid
session = find_session(sid)
env[SESSION_RECORD_KEY] = session
[sid, session.data]
Expand Down

0 comments on commit 0f0bdae

Please sign in to comment.