[PATCH] RM#3508 - Ensure that all sessions expire

Matt Wagner matt.wagner at redhat.com
Tue Aug 14 21:52:38 UTC 2012


Tomáš,

A couple nits inline, but this seems to work now:

On Tue, Aug 14, 2012 at 10:05:24PM +0200, Tomáš Hrčka wrote:
> @@ -422,4 +422,11 @@ class ApplicationController < ActionController::Base
>      result
>    end
>  
> +  #before filter to invalidate session for backbone
> +  def check_session
> +    return unless request.format == :json
> +    logout if SessionEntity.find_by_session_id(current_session).present? &&
> +        SessionEntity.find_by_session_id(current_session).created_at < 15.minutes.ago

I don't love that we call this lookup twice. Can we pull it out into a
separate line, e.g.:

  session_entity = SessionEntity.find_by_session_id(current_session)
  logout if session_entity.present? && session_entity.created_at < 15.minutes.ago

The query cache should actually handle the duplicate lookup, but since
we're in a global before_filter I'd rather be extra-careful about not
running redundant queries.

> diff --git a/src/spec/controllers/pools_controller_spec.rb b/src/spec/controllers/pools_controller_spec.rb
> index ba68755..89f42de 100644
> --- a/src/spec/controllers/pools_controller_spec.rb
> +++ b/src/spec/controllers/pools_controller_spec.rb
> @@ -95,6 +95,7 @@ describe PoolsController do
>  
>      it "should return 401" do
>        get :index
> +      puts response.body
>        response.response_code.should == 401
>      end

This looks like debugging mistakenly left in. Mind pulling this out?

(I feel compelled to note that you stayed super-late to get this
debugged and create a patch, so don't take my nits too harshly, and
thanks for the dedication!)

Overall, this seems to have finally fixed this issue. Tests now pass,
and Backbone requests do get expired after the appropriate timeout
interval, with no exceptions occurring. So, ACK! (Yay!)

I'm going to hold off pushing since I recommended a few modifications
that I wouldn't mind having you look over. But if you agree with them
and want to push with those changes in the morning, be my guest.

-- Matt



More information about the aeolus-devel mailing list