summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2019-01-17 16:08:36 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2019-01-21 14:33:21 +0100
commitd67d0dfb2bec0619ad2898220e6f5050a9e7689e (patch)
treecdd950f93f888b319085ea48326c5c6362b65140 /app/workers
parentd56b76a52dbb978982c3dedba333523e908b37db (diff)
downloadgitlab-ce-d67d0dfb2bec0619ad2898220e6f5050a9e7689e.tar.gz
Refactor BuildFinishedWorker for EE
This simply moves the logic from the "perform" method into a separate "process_build" method, allowing EE to more easily extend this behaviour.
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/build_finished_worker.rb26
1 files changed, 19 insertions, 7 deletions
diff --git a/app/workers/build_finished_worker.rb b/app/workers/build_finished_worker.rb
index 61d866b1f02..ae853ec9316 100644
--- a/app/workers/build_finished_worker.rb
+++ b/app/workers/build_finished_worker.rb
@@ -9,14 +9,26 @@ class BuildFinishedWorker
# rubocop: disable CodeReuse/ActiveRecord
def perform(build_id)
Ci::Build.find_by(id: build_id).try do |build|
- # We execute that in sync as this access the files in order to access local file, and reduce IO
- BuildTraceSectionsWorker.new.perform(build.id)
- BuildCoverageWorker.new.perform(build.id)
-
- # We execute that async as this are two independent operations that can be executed after TraceSections and Coverage
- BuildHooksWorker.perform_async(build.id)
- ArchiveTraceWorker.perform_async(build.id)
+ process_build(build)
end
end
# rubocop: enable CodeReuse/ActiveRecord
+
+ private
+
+ # Processes a single CI build that has finished.
+ #
+ # This logic resides in a separate method so that EE can extend it more
+ # easily.
+ #
+ # @param [Ci::Build] build The build to process.
+ def process_build(build)
+ # We execute these in sync to reduce IO.
+ BuildTraceSectionsWorker.new.perform(build.id)
+ BuildCoverageWorker.new.perform(build.id)
+
+ # We execute these async as these are independent operations.
+ BuildHooksWorker.perform_async(build.id)
+ ArchiveTraceWorker.perform_async(build.id)
+ end
end