make access token last_used update threshold a Setting

Change-Id: Ice322e7226e32506f65b96d255de9dae0cfc33a5
Reviewed-on: https://gerrit.instructure.com/24266
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2013-09-10 19:33:10 -06:00
parent 89b82aad95
commit 032e265d25
1 changed files with 5 additions and 1 deletions

View File

@ -42,8 +42,12 @@ class AccessToken < ActiveRecord::Base
developer_key.try(:name) || "No App"
end
def record_last_used_threshold
Setting.get_cached('access_token_last_used_threshold', 10.minutes).to_i
end
def used!
if !last_used_at || last_used_at < 5.minutes.ago
if !last_used_at || last_used_at < record_last_used_threshold.ago
self.last_used_at = Time.now
self.save
end