diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-09-18 09:53:31 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-02 18:02:11 +0300 |
commit | 22e00b08e89f72eb0fefea2d1d623667c4461773 (patch) | |
tree | 3c555d28f6732d5b154f06aa20423d14640ac895 /app/workers | |
parent | e265fc3e28dbfe53d96646588a1587d5626e92de (diff) |
Make schedule and unschedule consistent
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/ci/build_schedule_worker.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/workers/ci/build_schedule_worker.rb b/app/workers/ci/build_schedule_worker.rb index 9f81aa3c71e..84ef2edb767 100644 --- a/app/workers/ci/build_schedule_worker.rb +++ b/app/workers/ci/build_schedule_worker.rb @@ -7,13 +7,10 @@ module Ci def perform(build_id) ::Ci::Build.preload(:build_schedule).find_by(id: build_id).try do |build| - break unless build.build_schedule.present? + break unless build.scheduled? - begin - Ci::PlayBuildService.new(build.project, build.user).execute(build) - ensure - build.unschedule - end + build.unschedule! + Ci::PlayBuildService.new(build.project, build.user).execute(build) end end end |