diff options
Diffstat (limited to 'app/workers/concerns')
5 files changed, 13 insertions, 15 deletions
diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb index 222d045b0ba..e2e31b0a5bd 100644 --- a/app/workers/concerns/application_worker.rb +++ b/app/workers/concerns/application_worker.rb @@ -36,6 +36,11 @@ module ApplicationWorker @done_log_extra_metadata[key] = value end + def log_hash_metadata_on_done(hash) + @done_log_extra_metadata ||= {} + hash.each { |key, value| @done_log_extra_metadata[key] = value } + end + def logging_extras return {} unless @done_log_extra_metadata diff --git a/app/workers/concerns/git_garbage_collect_methods.rb b/app/workers/concerns/git_garbage_collect_methods.rb index c5f8c9c8464..718031ec33e 100644 --- a/app/workers/concerns/git_garbage_collect_methods.rb +++ b/app/workers/concerns/git_garbage_collect_methods.rb @@ -57,7 +57,7 @@ module GitGarbageCollectMethods end def gc?(task) - task == :gc || task == :prune + %i[gc eager prune].include?(task) end def try_obtain_lease(key) @@ -87,7 +87,7 @@ module GitGarbageCollectMethods if task == :prune client.prune_unreachable_objects else - client.optimize_repository + client.optimize_repository(eager: task == :eager) end rescue GRPC::NotFound => e Gitlab::GitLogger.error("#{__method__} failed:\nRepository not found") diff --git a/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb b/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb index 0a43a0fc4d2..64fa705329e 100644 --- a/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb +++ b/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb @@ -25,8 +25,8 @@ module Gitlab end end - def try_import(*args) - import(*args) + def try_import(...) + import(...) true rescue RateLimitError false diff --git a/app/workers/concerns/limited_capacity/worker.rb b/app/workers/concerns/limited_capacity/worker.rb index bcedb4efcc0..af66d80b3e9 100644 --- a/app/workers/concerns/limited_capacity/worker.rb +++ b/app/workers/concerns/limited_capacity/worker.rb @@ -61,8 +61,8 @@ module LimitedCapacity end end - def perform(*args) - perform_registered(*args) if job_tracker.register(jid, max_running_jobs) + def perform(...) + perform_registered(...) if job_tracker.register(jid, max_running_jobs) end def perform_work(*args) @@ -81,9 +81,9 @@ module LimitedCapacity job_tracker.clean_up end - def report_prometheus_metrics(*args) + def report_prometheus_metrics(...) report_running_jobs_metrics - set_metric(:remaining_work_gauge, remaining_work_count(*args)) + set_metric(:remaining_work_gauge, remaining_work_count(...)) set_metric(:max_running_jobs_gauge, max_running_jobs) end diff --git a/app/workers/concerns/waitable_worker.rb b/app/workers/concerns/waitable_worker.rb index f23e3fb20c2..1fe950b7570 100644 --- a/app/workers/concerns/waitable_worker.rb +++ b/app/workers/concerns/waitable_worker.rb @@ -3,13 +3,6 @@ module WaitableWorker extend ActiveSupport::Concern - class_methods do - # Schedules multiple jobs and waits for them to be completed. - def bulk_perform_and_wait(args_list) - bulk_perform_async(args_list) - end - end - def perform(*args) notify_key = args.pop if Gitlab::JobWaiter.key?(args.last) |