diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-07-06 11:08:54 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-07-06 11:08:54 +0300 |
commit | 82f6b4b0ab17d70d1ff291e2e4e114655ef255ae (patch) | |
tree | d4619b0772ae3df471f0a1b0587712796f4eeaea /app | |
parent | a29124bf9f15028b6eaf9aa5ca86cc963528c9cf (diff) | |
parent | 1667b65c1ea43882da1611c4454618d8a1eca8cc (diff) |
Merge branch 'fix-trace-archive-cron-worker-race-condition' into 'master'
Check if the existences of archived traces before archive it
Closes #48705
See merge request gitlab-org/gitlab-ce!20297
Diffstat (limited to 'app')
-rw-r--r-- | app/workers/archive_trace_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/ci/archive_traces_cron_worker.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/workers/archive_trace_worker.rb b/app/workers/archive_trace_worker.rb index 9169f21af2a..c6f89a17729 100644 --- a/app/workers/archive_trace_worker.rb +++ b/app/workers/archive_trace_worker.rb @@ -5,7 +5,7 @@ class ArchiveTraceWorker include PipelineBackgroundQueue def perform(job_id) - Ci::Build.find_by(id: job_id).try do |job| + Ci::Build.without_archived_trace.find_by(id: job_id).try do |job| job.trace.archive! end end diff --git a/app/workers/ci/archive_traces_cron_worker.rb b/app/workers/ci/archive_traces_cron_worker.rb index 7016edde698..7d4e9660a4e 100644 --- a/app/workers/ci/archive_traces_cron_worker.rb +++ b/app/workers/ci/archive_traces_cron_worker.rb @@ -12,6 +12,7 @@ module Ci Ci::Build.finished.with_live_trace.find_each(batch_size: 100) do |build| begin build.trace.archive! + rescue ::Gitlab::Ci::Trace::AlreadyArchivedError rescue => e failed_archive_counter.increment Rails.logger.error "Failed to archive stale live trace. id: #{build.id} message: #{e.message}" |