Skip to content

Can't make it work #9

Description

@md-farhan-memon

Hi,
I am trying this in my rails project with following details

Sidekiq: v6.5.8
Ruby: v3.1.3
Rails: v7.0.4.3

Sidekiq Config

Sidekiq.configure_server do |config|
    config.redis = REDIS_POOL
    config.error_handlers << Proc.new do |ex, ctx_hash|
      Rails.logger.error('Captured in sidekiq error block')
      Airbrake.notify(ex, ctx_hash)
    end
    SidekiqScheduler::Scheduler.enabled = false

    # ====================== Queue Pause Config =============================
    # https://github.com/projectivetech/sidekiq-queue-pause
    # ====================== Queue Pause Config =============================

    config[:fetch] = Sidekiq::QueuePause::PausingFetch.new(config)

    # Optionally, you may set some unique key identifying the
    # Sidekiq process you want to control. This (server) process will
    # only be paused/unpaused when the function gets called with
    # the corresponding key. See below.
    # Sidekiq::QueuePause.process_key = 'foo'

    # You may also pass in a Proc which is then evaluated when needed.
    # Sidekiq::QueuePause.process_key { SomeClass.some_method }

    # Optionally, you may configure the sleep period (in seconds) after the
    # queue lock has been checked. By default, the fetcher will sleep for
    # Sidekiq::Fetcher::TIMEOUT, i.e. the same time that the redis fetch
    # command may take.
    # Sidekiq::QueuePause.retry_after = 5
  end

Other Sidekiq related dependencies

gem 'sidekiq-limit_fetch', '4.4.1'
gem "sidekiq-bulk"
gem 'sidekiq-scheduler'
gem 'sidekiq-failures'

Here's what I am doing

irb(main):008:0> Sidekiq::QueuePause.paused?(:api_cloudwatch_dashboard_queue)
=> false
irb(main):009:0> Sidekiq::QueuePause.pause(:api_cloudwatch_dashboard_queue)
=> "OK"
irb(main):010:0> Sidekiq::QueuePause.paused?(:api_cloudwatch_dashboard_queue)
=> true

I can see it in UI too...

image

However, when pushing a new task using .perform_async it is getting immediately processed instead of holding back due to pause.

What am I missing here?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions