Add support for FASP data sharing (#34415)
This commit is contained in:
parent
3ea1f074ab
commit
a5a2c6dc7e
38 changed files with 1140 additions and 1 deletions
32
app/workers/fasp/backfill_worker.rb
Normal file
32
app/workers/fasp/backfill_worker.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Fasp::BackfillWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'fasp', retry: 5
|
||||
|
||||
def perform(backfill_request_id)
|
||||
backfill_request = Fasp::BackfillRequest.find(backfill_request_id)
|
||||
|
||||
announce(backfill_request)
|
||||
|
||||
backfill_request.advance!
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
# ignore missing backfill requests
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def announce(backfill_request)
|
||||
Fasp::Request.new(backfill_request.fasp_provider).post('/data_sharing/v0/announcements', body: {
|
||||
source: {
|
||||
backfillRequest: {
|
||||
id: backfill_request.id.to_s,
|
||||
},
|
||||
},
|
||||
category: backfill_request.category,
|
||||
objectUris: backfill_request.next_uris,
|
||||
moreObjectsAvailable: backfill_request.more_objects_available?,
|
||||
})
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue