1. 04 May, 2021 2 commits
    • Jacob Vosmaer's avatar
      Only count running jobs in LimitedCapacity::Worker · 9b02b9f6
      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
    • Jacob Vosmaer's avatar
      Use perform_with_capacity to schedule ReverificationBatchWorker · 1c837773
      Jacob Vosmaer authored
      Geo::ReverificationBatchWorker uses the LimitedCapacity::Worker
      concern. For that concern to work correctly, we must periodically
      reschedule jobs and perform cleanup by calling perform_with_capacity.
      Before this commit, we were never calling perform_with_capacity on
      Geo::ReverificationBatchWorker, meaning we never ran the cleanup code.
      This commit fixes that by replacing perform_async with
      perform_with_capacity.
      1c837773
  2. 03 May, 2021 1 commit
    • Jacob Vosmaer's avatar
      Remaining work does not depend on Sidekiq capacity · cf49dfd1
      Jacob Vosmaer authored
      This updates the remaining_work_count method on two Geo workers that
      use LimitedCapacity::Worker. The purpose of remaining_work_count is to
      tell LimitedCapacity::Worker if there is work to be done. Whether
      there is work to be done should not depend on how busy Sidekiq is.
      cf49dfd1
  3. 27 Apr, 2021 1 commit
  4. 26 Apr, 2021 36 commits