ixti / sidekiq-throttled

Concurrency and rate-limit throttling for Sidekiq
MIT License
698 stars 75 forks source link

fix: middleware not finalizing correctly when job is ActiveJob #151

Closed malavbhavsar closed 1 year ago

malavbhavsar commented 1 year ago

I noticed this when I was using concurrency with ActiveJob. For the example below, only 2 instances of ExampleJob would process and not clear the lock.

class ApplicationJob < ActiveJob::Base
  include Sidekiq::Throttled::Job
end

class ExampleJob < ApplicationJob
  sidekiq_throttle(
    concurrency: { limit: 2 },
  )

  def perform
    # do something
  end
end

Digging deeper, this call was missed in earlier changes to support ActiveJob. Fixed that and added tests to prevent regression.

ixti commented 1 year ago

Thank you!

malavbhavsar commented 1 year ago

🙏 thanks @ixti. No rush but any timeline for the next version bump? So I can remove this monkey patch from our application.