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:
parent
89b82aad95
commit
032e265d25
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue