diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-18 18:09:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-18 18:09:08 +0300 |
commit | cc1066db64a2a283a3d229b9bbb67c01716ca871 (patch) | |
tree | c5a518fabe9bb87b17a1f99b6c2616144170ebeb /app/models/packages | |
parent | 5c5d24f032b67d98452f391192386e330a0f880c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/packages')
-rw-r--r-- | app/models/packages/cleanup/policy.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/packages/cleanup/policy.rb b/app/models/packages/cleanup/policy.rb index c0585a52e6e..35f58f3680d 100644 --- a/app/models/packages/cleanup/policy.rb +++ b/app/models/packages/cleanup/policy.rb @@ -23,6 +23,17 @@ module Packages where.not(keep_n_duplicated_package_files: 'all') end + def self.with_packages + exists_select = ::Packages::Package.installable + .where('packages_packages.project_id = packages_cleanup_policies.project_id') + .select(1) + where('EXISTS (?)', exists_select) + end + + def self.runnable + runnable_schedules.with_packages.order(next_run_at: :asc) + end + def set_next_run_at # fixed cadence of 12 hours self.next_run_at = Time.zone.now + 12.hours |