From 8bb06c04ba9f094ba72d6a906d5df921da64647d Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sat, 22 Jan 2022 04:04:05 +0000 Subject: Update session token only once per minute (#29041). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@21376 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/user.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/user.rb b/app/models/user.rb index 25530541e..8c190374f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -469,7 +469,14 @@ class User < Principal if Setting.session_timeout? scope = scope.where("updated_on > ?", Setting.session_timeout.to_i.minutes.ago) end - scope.update_all(:updated_on => Time.now) == 1 + last_updated = scope.maximum(:updated_on) + if last_updated.nil? + false + elsif last_updated <= 1.minute.ago + scope.update_all(:updated_on => Time.now) == 1 + else + true + end end # Return an array of project ids for which the user has explicitly turned mail notifications on -- cgit v1.2.3