-
Jacob Vosmaer authored
The old implementation of LimitedCapacity::Worker relies on querying the number of jobs enqueued for the worker it applies to. In https://gitlab.com/groups/gitlab-com/gl-infra/-/epics/447 we are working towards a situation where you can no longer get this number from Sidekiq (in an efficient way, at least). This commit changes the capacity checking logic to only use the set of "running jobs". The capacity check now happens in exactly one place, namely LimitedCapacity::Worker#perform. LimitedCapacity::Worker.perform_with_capacity now always schedules max_running_jobs jobs. Sometimes these will be no-ops but that is OK, we expect less than 0.01 no-op jobs per second on GitLab.com.
9b02b9f6