Skip to content

Commit 2f1e1ab

Browse files
authored
Merge pull request #33 from RadiusNetworks/fix-rake-task
Fix rake task for Rails 4.2
2 parents 1f33fa3 + c905b01 commit 2f1e1ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/tasks/kracken.rake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ namespace :kracken do
55
desc "Remove expired credentials after threshold days " \
66
"(default threshold is 90 days)"
77
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
1010
Rails.logger.info "Clearing expired `Credentials` older than " \
11-
"#{threshold.inspect} (#{timestamp})"
11+
"#{threshold.days.inspect} (#{timestamp})"
1212
expired = Credentials.where(expires: true)
1313
.where("expires_at < ?", timestamp)
1414
.destroy_all
1515
.size
1616
Rails.logger.info "Removed: #{expired} credentials"
1717
threshold *= 2
18-
timestamp = threshold.ago
18+
timestamp = threshold.days.ago
1919
Rails.logger.info "Clearing legacy `Credentials` older than " \
20-
"#{threshold.inspect} (#{timestamp})"
20+
"#{threshold.days.inspect} (#{timestamp})"
2121
legacy = Credentials.where(expires: [nil, false])
2222
.where("updated_at < ?", timestamp)
2323
.destroy_all

0 commit comments

Comments
 (0)