From b6398744b02aef9b01393c92a59de760899b0e3a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 25 Aug 2013 23:34:54 +0200 Subject: [PATCH] Fixed "lost session cookie" bug. --- app/controllers/application_controller.rb | 5 ++++- app/models/observer/session.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c37b92707..da33e0a65 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -79,7 +79,10 @@ class ApplicationController < ActionController::Base # update session updated_at def session_update - session[:ping] = Time.now.utc.iso8601 + + # on many paralell requests, session got reinitialised if Time. is used, as workaround use DateTime. + #session[:ping] = Time.now.utc.iso8601 + session[:ping] = DateTime.now.iso8601 # check if remote ip need to be updated if !session[:remote_id] || session[:remote_id] != request.remote_ip diff --git a/app/models/observer/session.rb b/app/models/observer/session.rb index 7847a20a9..fdd96c2f8 100644 --- a/app/models/observer/session.rb +++ b/app/models/observer/session.rb @@ -14,7 +14,7 @@ class Observer::Session < ActiveRecord::Observer def check(record) return if !record.data - + return if record[:request_type] # remember request type if record.data['request_type'] record[:request_type] = record.data['request_type']