1
0
Fork 0
forked from gitea/nas

Add support for FASP data sharing (#34415)

This commit is contained in:
David Roetzel 2025-05-16 14:24:02 +02:00 committed by GitHub
parent 3ea1f074ab
commit a5a2c6dc7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 1140 additions and 1 deletions

View 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