Class: LeaseExpiryJob

Inherits:
Hyrax::ApplicationJob show all
Defined in:
app/jobs/lease_expiry_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



3
4
5
6
7
8
# File 'app/jobs/lease_expiry_job.rb', line 3

def perform
  records_with_expired_leases.each do |id|
    work = ActiveFedora::Base.find(id)
    Hyrax::Actors::LeaseActor.new(work).destroy
  end
end

#records_with_expired_leasesEnumerator<String>

Returns ids for all the objects that have expired active leases.

Returns:

  • (Enumerator<String>)

    ids for all the objects that have expired active leases



12
13
14
# File 'app/jobs/lease_expiry_job.rb', line 12

def records_with_expired_leases
  Hyrax::LeaseService.assets_with_expired_leases.map(&:id)
end