From d430092ba217a3d453d446f4d33522a26f0b6288 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 14 Feb 2018 02:24:40 +0200 Subject: [PATCH] Extract method #700 --- app/controllers/epp_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/epp_controller.rb b/app/controllers/epp_controller.rb index 91296aa42..8fe93ae4a 100644 --- a/app/controllers/epp_controller.rb +++ b/app/controllers/epp_controller.rb @@ -388,7 +388,7 @@ class EppController < ApplicationController def update_epp_session iptables_counter_update - if !Rails.env.development? && (epp_session.updated_at < Time.zone.now - 5.minutes) + if !Rails.env.development? && session_timeout_reached? @api_user = current_user # cache current_user for logging epp_session.destroy response.headers['X-EPP-Returncode'] = '1500' @@ -403,4 +403,9 @@ class EppController < ApplicationController epp_session.update_column(:updated_at, Time.zone.now) end end + + def session_timeout_reached? + timeout = 5.minutes + epp_session.updated_at < (Time.zone.now - timeout) + end end