summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/workers/ci/archive_traces_cron_worker.rb13
-rw-r--r--changelogs/unreleased/use-archive-trace-worker-in-cron-worker.yml6
2 files changed, 18 insertions, 1 deletions
diff --git a/app/workers/ci/archive_traces_cron_worker.rb b/app/workers/ci/archive_traces_cron_worker.rb
index f65ff239866..f0eb2cb16e0 100644
--- a/app/workers/ci/archive_traces_cron_worker.rb
+++ b/app/workers/ci/archive_traces_cron_worker.rb
@@ -11,7 +11,18 @@ module Ci
# This could happen when ArchiveTraceWorker sidekiq jobs were lost by receiving SIGKILL
# More details in https://gitlab.com/gitlab-org/gitlab-ce/issues/36791
Ci::Build.finished.with_live_trace.find_each(batch_size: 100) do |build|
- Ci::ArchiveTraceService.new.execute(build)
+ if Feature.enabled?(:ci_archive_trace_async)
+ ArchiveTraceWorker.perform_async(build.id)
+ else
+ begin
+ Ci::ArchiveTraceService.new.execute(build)
+ ensure
+ ##
+ # This is the temporary solution for avoiding the memory bloat.
+ # See more https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/4667#note_192401907
+ GC.start if Feature.enabled?(:ci_archive_trace_force_gc, default_enabled: true)
+ end
+ end
end
end
# rubocop: enable CodeReuse/ActiveRecord
diff --git a/changelogs/unreleased/use-archive-trace-worker-in-cron-worker.yml b/changelogs/unreleased/use-archive-trace-worker-in-cron-worker.yml
new file mode 100644
index 00000000000..c5c1d210b34
--- /dev/null
+++ b/changelogs/unreleased/use-archive-trace-worker-in-cron-worker.yml
@@ -0,0 +1,6 @@
+---
+title: Fix ArchiveTracesCronWorker respawning in a short interval by sidekiq memory
+ killer
+merge_request: 30940
+author:
+type: fixed