diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/models/ci/pipeline_schedule.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/models/ci/pipeline_schedule.rb')
-rw-r--r-- | app/models/ci/pipeline_schedule.rb | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/app/models/ci/pipeline_schedule.rb b/app/models/ci/pipeline_schedule.rb index 3c17246bc34..9e5d517c1fe 100644 --- a/app/models/ci/pipeline_schedule.rb +++ b/app/models/ci/pipeline_schedule.rb @@ -5,7 +5,7 @@ module Ci extend Gitlab::Ci::Model include Importable include StripAttribute - include Schedulable + include CronSchedulable include Limitable include EachBatch @@ -51,38 +51,16 @@ module Ci update_attribute(:active, false) end - ## - # The `next_run_at` column is set to the actual execution date of `PipelineScheduleWorker`. - # This way, a schedule like `*/1 * * * *` won't be triggered in a short interval - # when PipelineScheduleWorker runs irregularly by Sidekiq Memory Killer. - def set_next_run_at - now = Time.zone.now - ideal_next_run = ideal_next_run_from(now) - - self.next_run_at = if ideal_next_run == cron_worker_next_run_from(now) - ideal_next_run - else - cron_worker_next_run_from(ideal_next_run) - end - end - def job_variables variables&.map(&:to_runner_variable) || [] end private - def ideal_next_run_from(start_time) - Gitlab::Ci::CronParser.new(cron, cron_timezone) - .next_time_from(start_time) - end - - def cron_worker_next_run_from(start_time) - Gitlab::Ci::CronParser.new(Settings.cron_jobs['pipeline_schedule_worker']['cron'], - Time.zone.name) - .next_time_from(start_time) + def worker_cron_expression + Settings.cron_jobs['pipeline_schedule_worker']['cron'] end end end -Ci::PipelineSchedule.prepend_if_ee('EE::Ci::PipelineSchedule') +Ci::PipelineSchedule.prepend_mod_with('Ci::PipelineSchedule') |