summaryrefslogtreecommitdiff
path: root/app/workers/ci
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-06-02 13:08:34 +0900
committerShinya Maeda <shinya@gitlab.com>2018-06-06 17:49:48 +0900
commit5a1ee0c391a06a323d960eab6ffb33dfcf2edca7 (patch)
tree0112d50f35408d4c04c4c6e8b4e473989a08eb97 /app/workers/ci
parent2084e7ab9aad92d4a8196af01b9b8e02ffacb0a4 (diff)
downloadgitlab-ce-5a1ee0c391a06a323d960eab6ffb33dfcf2edca7.tar.gz
Fix the query to select stale live traces
Diffstat (limited to 'app/workers/ci')
-rw-r--r--app/workers/ci/rescue_stale_live_trace_worker.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/app/workers/ci/rescue_stale_live_trace_worker.rb b/app/workers/ci/rescue_stale_live_trace_worker.rb
index 6c8a20f64dd..156ed61c2c5 100644
--- a/app/workers/ci/rescue_stale_live_trace_worker.rb
+++ b/app/workers/ci/rescue_stale_live_trace_worker.rb
@@ -4,16 +4,14 @@ module Ci
include CronjobQueue
def perform
- # Archive live traces which still resides in redis or database
- # This could happen when sidekiq-jobs for archivements are lost by SIGKILL
- # Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/36791
- Ci::Build.find_builds_from_stale_live_traces do |builds|
- builds.each do |build|
- begin
- build.trace.archive!
- rescue => e
- Rails.logger.error "Failed to archive stale live trace. id: #{build.id} message: #{e.message}"
- end
+ # Archive stale live traces which still resides in redis or database
+ # 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|
+ begin
+ build.trace.archive!
+ rescue => e
+ Rails.logger.error "Failed to archive stale live trace. id: #{build.id} message: #{e.message}"
end
end
end