Class: Packages::Debian::GenerateDistributionService
- Inherits:
-
Object
- Object
- Packages::Debian::GenerateDistributionService
- Includes:
- ExclusiveLeaseGuard, Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/packages/debian/generate_distribution_service.rb
Constant Summary collapse
- ONE_HOUR =
1.hour.freeze
- DEFAULT_LEASE_TIMEOUT =
used by ExclusiveLeaseGuard
1.hour.to_i.freeze
- METADATA_KEYS =
%w[ Package Source Binary Version Essential Installed-Size Maintainer Uploaders Original-Maintainer Build-Depends Build-Depends-Indep Build-Conflicts Build-Conflicts-Indep Architecture Standards-Version Format Files Dm-Upload-Allowed Vcs-Browse Vcs-Hg Vcs-Darcs Vcs-Svn Vcs-Git Vcs-Browser Vcs-Arch Vcs-Bzr Vcs-Mtn Vcs-Cvs Checksums-Sha256 Checksums-Sha1 Replaces Provides Depends Pre-Depends Recommends Suggests Enhances Conflicts Breaks Description Origin Bugs Multi-Arch Homepage Tag Package-Type Installer-Menu-Item ].freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(distribution) ⇒ GenerateDistributionService
constructor
A new instance of GenerateDistributionService.
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Constructor Details
#initialize(distribution) ⇒ GenerateDistributionService
Returns a new instance of GenerateDistributionService.
65 66 67 68 69 |
# File 'app/services/packages/debian/generate_distribution_service.rb', line 65 def initialize(distribution) @distribution = distribution @oldest_kept_generated_at = nil @sha256 = [] end |
Instance Method Details
#execute ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/services/packages/debian/generate_distribution_service.rb', line 71 def execute try_obtain_lease do @distribution.transaction do # We consider `apt-get update` can take at most one hour # We keep all generations younger than one hour # and the previous generation @oldest_kept_generated_at = @distribution.component_files.updated_before(release_date - ONE_HOUR).maximum(:updated_at) generate_component_files generate_release destroy_old_component_files end end end |