• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_describe / 4e4e59fc-9df4-4838-9fd4-6c7ea33cdb7c

07 Apr 2025 06:36PM UTC coverage: 1.283% (-94.6%) from 95.862%
4e4e59fc-9df4-4838-9fd4-6c7ea33cdb7c

Pull #1994

circleci

hectorcorrea
Switched to use the autocomplete that we aleady use for ROR. Integrated it with the existing logic for creators
Pull Request #1994: Started adding auto complete to contributors

0 of 46 new or added lines in 2 files covered. (0.0%)

4806 existing lines in 74 files now uncovered.

65 of 5065 relevant lines covered (1.28%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/jobs/dspace_file_copy_job.rb
1
# frozen_string_literal: true
UNCOV
2
class DspaceFileCopyJob < ApplicationJob
×
UNCOV
3
  queue_as :default
×
4

UNCOV
5
  def perform(s3_file_json:, work_id:, migration_snapshot_id:)
×
UNCOV
6
    s3_file = JSON.parse(s3_file_json)
×
UNCOV
7
    work = Work.find(work_id)
×
UNCOV
8
    new_key = s3_file["filename_display"]
×
UNCOV
9
    s3_key = s3_file["filename"]
×
UNCOV
10
    s3_size = s3_file["size"]
×
UNCOV
11
    resp = work.s3_query_service.copy_file(source_key: "#{dspace_bucket_name}/#{s3_key}",
×
UNCOV
12
                                           target_bucket: work.s3_query_service.bucket_name,
×
UNCOV
13
                                           target_key: new_key, size: s3_size)
×
UNCOV
14
    unless resp.successful?
×
15
      raise "Error copying #{s3_key} to work #{work_id} Response #{resp}"
×
UNCOV
16
    end
×
UNCOV
17
    if s3_size > 0 # All directories are not part of the migration snapshot
×
UNCOV
18
      update_migration(migration_snapshot_id, new_key, s3_size, work)
×
UNCOV
19
    end
×
UNCOV
20
  end
×
21

UNCOV
22
  private
×
23

UNCOV
24
    def dspace_bucket_name
×
UNCOV
25
      @dspace_bucket_name ||= Rails.configuration.s3.dspace[:bucket]
×
UNCOV
26
    end
×
27

UNCOV
28
    def update_migration(migration_snapshot_id, s3_key, s3_size, work)
×
UNCOV
29
      migration_snapshot = MigrationUploadSnapshot.find(migration_snapshot_id)
×
UNCOV
30
      migration_snapshot.with_lock do
×
UNCOV
31
        migration_snapshot.reload
×
UNCOV
32
        migration_snapshot.mark_complete(S3File.new(filename: s3_key, last_modified: DateTime.now, size: s3_size, checksum: "", work:))
×
UNCOV
33
        migration_snapshot.save!
×
UNCOV
34
      end
×
35

UNCOV
36
    rescue ActiveRecord::StatementInvalid
×
UNCOV
37
      ActiveRecord::Base.connection_pool.release_connection
×
UNCOV
38
      retry
×
UNCOV
39
    end
×
UNCOV
40
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc