8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/sidekiq/lighthouse/document_upload_synchronous.rb', line 8
def self.upload(user_icn, document_hash)
client = BenefitsDocuments::WorkerService.new
document, file_body, uploader = nil
Datadog::Tracing.trace('Config/Initialize Synchronous Upload Document') do
Sentry.set_tags(source: 'documents-upload')
document = LighthouseDocument.new document_hash
raise Common::Exceptions::ValidationErrors, document_data unless document.valid?
uploader = LighthouseDocumentUploader.new(user_icn, document.uploader_ids)
uploader.retrieve_from_store!(document.file_name)
end
Datadog::Tracing.trace('Synchronous read_for_upload') do
file_body = uploader.read_for_upload
end
Datadog::Tracing.trace('Synchronous Upload Document') do |span|
span.set_tag('Document File Size', file_body.size)
client.upload_document(file_body, document)
end
Datadog::Tracing.trace('Remove Upload Document') do
uploader.remove!
end
end
|