Move all EE worker differences to EE specific modules
EE specific code that resides in app/workers
should be moved to the
corresponding EE specific modules that reside in ee/app/workers
, leaving
behind only the necessary prepend
and include
calls, which should be placed
at the end of the file).
Differences
app/workers/delete_user_worker.rb
diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/delete_user_worker.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/delete_user_worker.rb
index 4d0295f8d2e..ee0162fe695 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/delete_user_worker.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/delete_user_worker.rb
@@ -7,7 +7,7 @@ class DeleteUserWorker
delete_user = User.find(delete_user_id)
current_user = User.find(current_user_id)
- Users::DestroyService.new(current_user).execute(delete_user, options.symbolize_keys)
+ ::Users::DestroyService.new(current_user).execute(delete_user, options.symbolize_keys)
rescue Gitlab::Access::AccessDeniedError => e
Rails.logger.warn("User could not be destroyed: #{e}")
end
app/workers/build_finished_worker.rb
diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/build_finished_worker.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/build_finished_worker.rb
index 61d866b1f02..d76c0bf9f67 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/build_finished_worker.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/build_finished_worker.rb
@@ -9,6 +9,8 @@ class BuildFinishedWorker
# rubocop: disable CodeReuse/ActiveRecord
def perform(build_id)
Ci::Build.find_by(id: build_id).try do |build|
+ UpdateBuildMinutesService.new(build.project, nil).execute(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)
@@ -20,3 +22,5 @@ class BuildFinishedWorker
end
# rubocop: enable CodeReuse/ActiveRecord
end
+
+BuildFinishedWorker.prepend(EE::BuildFinishedWorker)
app/workers/stuck_import_jobs_worker.rb
diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/stuck_import_jobs_worker.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/stuck_import_jobs_worker.rb
index c8a186ba4ce..352b7f07c9d 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/stuck_import_jobs_worker.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/stuck_import_jobs_worker.rb
@@ -10,9 +10,16 @@ class StuckImportJobsWorker
import_state_without_jid_count = mark_import_states_without_jid_as_failed!
import_state_with_jid_count = mark_import_states_with_jid_as_failed!
- Gitlab::Metrics.add_event(:stuck_import_jobs,
- projects_without_jid_count: import_state_without_jid_count,
- projects_with_jid_count: import_state_with_jid_count)
+ values = {
+ projects_without_jid_count: import_state_without_jid_count,
+ projects_with_jid_count: import_state_with_jid_count
+ }
+
+ Gitlab::Metrics.add_event_with_values(:stuck_import_jobs, values)
+
+ stuck_import_jobs_worker_runs_counter.increment
+ import_state_without_jid_metric.set({}, import_state_without_jid_count)
+ import_state_with_jid_metric.set({}, import_state_with_jid_count)
end
private
@@ -65,4 +72,17 @@ class StuckImportJobsWorker
def error_message
_("Import timed out. Import took longer than %{import_jobs_expiration} seconds") % { import_jobs_expiration: IMPORT_JOBS_EXPIRATION }
end
+
+ def stuck_import_jobs_worker_runs_counter
+ @stuck_import_jobs_worker_runs_counter ||= Gitlab::Metrics.counter(:gitlab_stuck_import_jobs_worker_runs_total,
+ 'Stuck import jobs worker runs count')
+ end
+
+ def import_state_without_jid_metric
+ @import_state_without_jid_metric ||= Gitlab::Metrics.gauge(:gitlab_projects_without_jid, 'Projects without Job ids')
+ end
+
+ def import_state_with_jid_metric
+ @import_state_with_jid_metric ||= Gitlab::Metrics.gauge(:gitlab_projects_with_jid, 'Projects with Job ids')
+ end
end
app/workers/expire_pipeline_cache_worker.rb
diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/expire_pipeline_cache_worker.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/expire_pipeline_cache_worker.rb
index c96e8a0379b..181ad785fb7 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/workers/expire_pipeline_cache_worker.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/workers/expire_pipeline_cache_worker.rb
@@ -22,6 +22,13 @@ class ExpirePipelineCacheWorker
store.touch(path)
end
+ triggered_by = pipeline.triggered_by_pipeline
+ store.touch(project_pipeline_path(triggered_by.project, triggered_by)) if triggered_by
+
+ pipeline.triggered_pipelines.each do |triggered|
+ store.touch(project_pipeline_path(triggered.project, triggered))
+ end
+
Gitlab::Cache::Ci::ProjectPipelineStatus.update_for_pipeline(pipeline)
end
# rubocop: enable CodeReuse/ActiveRecord
Edited by Yorick Peterse