diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-07-04 10:11:57 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-07-05 04:52:50 +0300 |
commit | 68d5793985d36fc649cf7bc0e81b5ef988bca8b1 (patch) | |
tree | 226943200877719cb0c56711de4442982afd7566 /app | |
parent | d86bed76500350ab167cb4520fab038bdb7ead81 (diff) |
Fix spec
Diffstat (limited to 'app')
-rw-r--r-- | app/workers/archive_trace_worker.rb | 4 | ||||
-rw-r--r-- | app/workers/ci/archive_traces_cron_worker.rb | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/workers/archive_trace_worker.rb b/app/workers/archive_trace_worker.rb index 2eb93318d5e..c6f89a17729 100644 --- a/app/workers/archive_trace_worker.rb +++ b/app/workers/archive_trace_worker.rb @@ -5,8 +5,8 @@ class ArchiveTraceWorker include PipelineBackgroundQueue def perform(job_id) - Ci::Build.find_by(id: job_id).try do |job| - job.trace.archive! unless job.job_artifacts_trace + Ci::Build.without_archived_trace.find_by(id: job_id).try do |job| + job.trace.archive! end end end diff --git a/app/workers/ci/archive_traces_cron_worker.rb b/app/workers/ci/archive_traces_cron_worker.rb index 3fdfefba46d..eca1c681b23 100644 --- a/app/workers/ci/archive_traces_cron_worker.rb +++ b/app/workers/ci/archive_traces_cron_worker.rb @@ -11,8 +11,10 @@ module Ci # 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| begin - build.trace.archive! unless build.job_artifacts_trace + build.trace.archive! rescue => e + next if e.message.include?('Already archived') + failed_archive_counter.increment Rails.logger.error "Failed to archive stale live trace. id: #{build.id} message: #{e.message}" end |