Skip to content
Snippets Groups Projects
Unverified Commit aab064e9 authored by Sylvester Chin's avatar Sylvester Chin Committed by GitLab
Browse files

Track worker concurrency using Redis hash - 2nd try

The application track worker counts using a Redis hash per Sidekiq worker.
The hash fields are contain information of the Sidekiq process id and thread id.
The application also does a periodic hash clean up during
ConcurrencyLimit::ResumeWorker crons.

The change is behind a sidekiq_concurrency_limit_optimized_count feature flag.
parent 5cf2cfec
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -11,8 +11,13 @@ def gitlab_sidekiq_inline
# see https://github.com/sidekiq/sidekiq/issues/6069
Sidekiq::Testing.inline!
 
# Set a thread-local sidekiq capsule as it may be accessed in the
# Gitlab::SidekiqMiddleware::ConcurrencyLimit::WorkerExecutionTracker
Thread.current[:sidekiq_capsule] = Sidekiq::Capsule.new('test', Sidekiq.default_configuration)
yield
ensure
Thread.current[:sidekiq_capsule] = nil
Sidekiq::Testing.fake! # fake is the default so we reset it to that
redis_queues_cleanup!
redis_queues_metadata_cleanup!
Loading
Loading
Loading
Loading
@@ -24,6 +24,6 @@ def self.name
limit = 55
expect(Search).to receive(:default_concurrency_limit).and_return(limit)
 
expect(Gitlab::SidekiqMiddleware::ConcurrencyLimit::WorkersMap.limit_for(worker: worker_class)&.call).to eq(limit)
expect(Gitlab::SidekiqMiddleware::ConcurrencyLimit::WorkersMap.limit_for(worker: worker_class)).to eq(limit)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment