Commit 4de9ddb1 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '218994-replace-constant-usage' into 'master'

Replace IMPORT_JOBS_EXPIRATION constant usage

See merge request gitlab-org/gitlab!32947
parents 8c36d490 0d2b92d6
...@@ -15,7 +15,7 @@ module ImportState ...@@ -15,7 +15,7 @@ module ImportState
def refresh_jid_expiration def refresh_jid_expiration
return unless jid return unless jid
Gitlab::SidekiqStatus.set(jid, StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) Gitlab::SidekiqStatus.set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
end end
def self.jid_by(project_id:, status:) def self.jid_by(project_id:, status:)
......
...@@ -6,7 +6,7 @@ module ProjectImportOptions ...@@ -6,7 +6,7 @@ module ProjectImportOptions
IMPORT_RETRY_COUNT = 5 IMPORT_RETRY_COUNT = 5
included do included do
sidekiq_options retry: IMPORT_RETRY_COUNT, status_expiration: StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION sidekiq_options retry: IMPORT_RETRY_COUNT, status_expiration: Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION
# We only want to mark the project as failed once we exhausted all retries # We only want to mark the project as failed once we exhausted all retries
sidekiq_retries_exhausted do |job| sidekiq_retries_exhausted do |job|
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
class StuckImportJobsWorker # rubocop:disable Scalability/IdempotentWorker class StuckImportJobsWorker # rubocop:disable Scalability/IdempotentWorker
include Gitlab::Import::StuckImportJob include Gitlab::Import::StuckImportJob
IMPORT_JOBS_EXPIRATION = Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION
private private
def track_metrics(with_jid_count, without_jid_count) def track_metrics(with_jid_count, without_jid_count)
......
...@@ -10,7 +10,7 @@ class RepositoryUpdateMirrorWorker # rubocop:disable Scalability/IdempotentWorke ...@@ -10,7 +10,7 @@ class RepositoryUpdateMirrorWorker # rubocop:disable Scalability/IdempotentWorke
feature_category :source_code_management feature_category :source_code_management
# Retry not necessary. It will try again at the next update interval. # Retry not necessary. It will try again at the next update interval.
sidekiq_options retry: false, status_expiration: StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION sidekiq_options retry: false, status_expiration: Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION
attr_accessor :project, :repository, :current_user attr_accessor :project, :repository, :current_user
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
jid = generate_jid(import_state) jid = generate_jid(import_state)
Gitlab::SidekiqStatus Gitlab::SidekiqStatus
.set(jid, StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) .set(jid, Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
import_state.update_column(:jid, jid) import_state.update_column(:jid, jid)
end end
......
...@@ -63,7 +63,7 @@ module Gitlab ...@@ -63,7 +63,7 @@ module Gitlab
def timeout def timeout
# Setting the timeout to the same one as we do for clearing stuck jobs # Setting the timeout to the same one as we do for clearing stuck jobs
# this makes sure all cache is available while the import is running. # this makes sure all cache is available while the import is running.
StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION
end end
end end
end end
......
...@@ -40,7 +40,7 @@ module Gitlab ...@@ -40,7 +40,7 @@ module Gitlab
def timeout def timeout
# Make sure we get rid of all the information after a job is marked # Make sure we get rid of all the information after a job is marked
# as failed/succeeded # as failed/succeeded
StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION
end end
end end
end end
......
...@@ -8,7 +8,7 @@ describe Gitlab::Import::SetAsyncJid do ...@@ -8,7 +8,7 @@ describe Gitlab::Import::SetAsyncJid do
it 'sets the JID in Redis' do it 'sets the JID in Redis' do
expect(Gitlab::SidekiqStatus) expect(Gitlab::SidekiqStatus)
.to receive(:set) .to receive(:set)
.with("async-import/project-import-state/#{project.id}", StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) .with("async-import/project-import-state/#{project.id}", Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
.and_call_original .and_call_original
described_class.set_jid(project.import_state) described_class.set_jid(project.import_state)
......
...@@ -66,7 +66,7 @@ describe Gitlab::PhabricatorImport::Cache::Map, :clean_gitlab_redis_cache do ...@@ -66,7 +66,7 @@ describe Gitlab::PhabricatorImport::Cache::Map, :clean_gitlab_redis_cache do
end end
expect(set_data).to eq({ classname: 'Issue', database_id: issue.id.to_s }) expect(set_data).to eq({ classname: 'Issue', database_id: issue.id.to_s })
expect(ttl).to be_within(1.second).of(StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) expect(ttl).to be_within(1.second).of(Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
end end
end end
......
...@@ -17,7 +17,7 @@ describe ProjectImportOptions do ...@@ -17,7 +17,7 @@ describe ProjectImportOptions do
end end
it 'sets default status expiration' do it 'sets default status expiration' do
expect(worker_class.sidekiq_options['status_expiration']).to eq(StuckImportJobsWorker::IMPORT_JOBS_EXPIRATION) expect(worker_class.sidekiq_options['status_expiration']).to eq(Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION)
end end
describe '.sidekiq_retries_exhausted' do describe '.sidekiq_retries_exhausted' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment