blob: c1731112099f9bb2610be394be0844d19b0f6cbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# frozen_string_literal: true
module Packages
module Debian
class ProcessChangesWorker
include ApplicationWorker
include Gitlab::Utils::StrongMemoize
deduplicate :until_executed
idempotent!
queue_namespace :package_repositories
feature_category :package_registry
def perform(package_file_id, user_id)
@package_file_id = package_file_id
@user_id = user_id
return unless package_file && user
::Packages::Debian::ProcessChangesService.new(package_file, user).execute
rescue ArgumentError,
Packages::Debian::ExtractChangesMetadataService::ExtractionError,
Packages::Debian::ExtractDebMetadataService::CommandFailedError,
Packages::Debian::ExtractMetadataService::ExtractionError,
Packages::Debian::ParseDebian822Service::InvalidDebian822Error,
ActiveRecord::RecordNotFound => e
Gitlab::ErrorTracking.log_exception(e, package_file_id: @package_file_id, user_id: @user_id)
package_file.destroy!
end
private
attr_reader :package_file_id, :user_id
def package_file
strong_memoize(:package_file) do
::Packages::PackageFile.find_by_id(package_file_id)
end
end
def user
strong_memoize(:user) do
::User.find_by_id(user_id)
end
end
end
end
end
|