File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,19 +5,19 @@ namespace :kracken do
5
5
desc "Remove expired credentials after threshold days " \
6
6
"(default threshold is 90 days)"
7
7
task :credentials , %i[ threshold ] => :environment do |_t , args |
8
- threshold = args . fetch ( :threshold ) { 90 } . to_i . days
9
- timestamp = threshold . ago
8
+ threshold = args . fetch ( :threshold ) { 90 } . to_i
9
+ timestamp = threshold . days . ago
10
10
Rails . logger . info "Clearing expired `Credentials` older than " \
11
- "#{ threshold . inspect } (#{ timestamp } )"
11
+ "#{ threshold . days . inspect } (#{ timestamp } )"
12
12
expired = Credentials . where ( expires : true )
13
13
. where ( "expires_at < ?" , timestamp )
14
14
. destroy_all
15
15
. size
16
16
Rails . logger . info "Removed: #{ expired } credentials"
17
17
threshold *= 2
18
- timestamp = threshold . ago
18
+ timestamp = threshold . days . ago
19
19
Rails . logger . info "Clearing legacy `Credentials` older than " \
20
- "#{ threshold . inspect } (#{ timestamp } )"
20
+ "#{ threshold . days . inspect } (#{ timestamp } )"
21
21
legacy = Credentials . where ( expires : [ nil , false ] )
22
22
. where ( "updated_at < ?" , timestamp )
23
23
. destroy_all
You can’t perform that action at this time.
0 commit comments