Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/stuck_import_jobs_worker.rb')
-rw-r--r--app/workers/stuck_import_jobs_worker.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/workers/stuck_import_jobs_worker.rb b/app/workers/stuck_import_jobs_worker.rb
index fbb14efc525..6fdd7592e74 100644
--- a/app/workers/stuck_import_jobs_worker.rb
+++ b/app/workers/stuck_import_jobs_worker.rb
@@ -22,7 +22,8 @@ class StuckImportJobsWorker
end
def mark_projects_with_jid_as_failed!
- jids_and_ids = enqueued_projects_with_jid.pluck(:import_jid, :id).to_h
+ # TODO: Rollback this change to use SQL through #pluck
+ jids_and_ids = enqueued_projects_with_jid.map { |project| [project.import_jid, project.id] }.to_h
# Find the jobs that aren't currently running or that exceeded the threshold.
completed_jids = Gitlab::SidekiqStatus.completed_jids(jids_and_ids.keys)
@@ -42,15 +43,15 @@ class StuckImportJobsWorker
end
def enqueued_projects
- Project.with_import_status(:scheduled, :started)
+ Project.joins_import_state.where("(import_state.status = 'scheduled' OR import_state.status = 'started') OR (projects.import_status = 'scheduled' OR projects.import_status = 'started')")
end
def enqueued_projects_with_jid
- enqueued_projects.where.not(import_jid: nil)
+ enqueued_projects.where.not("import_state.jid IS NULL AND projects.import_jid IS NULL")
end
def enqueued_projects_without_jid
- enqueued_projects.where(import_jid: nil)
+ enqueued_projects.where("import_state.jid IS NULL AND projects.import_jid IS NULL")
end
def error_message