b6df93a51f
Addresses: Issue #13810 1. Adds a last_used_at attribute to the Key table/model 2. Update a key's last_used_at whenever it gets used 3. Display how long ago an ssh key was last used
13 lines
305 B
Ruby
13 lines
305 B
Ruby
class UseKeyWorker
|
|
include Sidekiq::Worker
|
|
include DedicatedSidekiqQueue
|
|
|
|
def perform(key_id)
|
|
key = Key.find(key_id)
|
|
key.touch(:last_used_at)
|
|
rescue ActiveRecord::RecordNotFound
|
|
Rails.logger.error("UseKeyWorker: couldn't find key with ID=#{key_id}, skipping job")
|
|
|
|
false
|
|
end
|
|
end
|