Module: Sidekiq::Grouping

Defined in:
lib/sidekiq/grouping/web.rb,
lib/sidekiq/grouping/batch.rb,
lib/sidekiq/grouping/redis.rb,
lib/sidekiq/grouping/version.rb,
lib/sidekiq/grouping/middleware.rb,
lib/sidekiq/grouping.rb

Defined Under Namespace

Modules: Config, Web Classes: Batch, Flusher, FlusherObserver, Middleware, Redis

Constant Summary collapse

VERSION =
"1.0.10"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject


18
19
20
# File 'lib/sidekiq/grouping.rb', line 18

def logger
  @logger ||= Sidekiq.logger
end

Class Method Details

.force_flush_for_test!Object


22
23
24
# File 'lib/sidekiq/grouping.rb', line 22

def force_flush_for_test!
  Sidekiq::Grouping::Flusher.new.force_flush_for_test!
end

.start!Object


26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sidekiq/grouping.rb', line 26

def start!
  interval = Sidekiq::Grouping::Config.poll_interval
  @observer = Sidekiq::Grouping::FlusherObserver.new
  @task = Concurrent::TimerTask.new(
    execution_interval: interval
  ) { Sidekiq::Grouping::Flusher.new.flush }
  @task.add_observer(@observer)
  logger.info(
    "[Sidekiq::Grouping] Started polling batches every #{interval} seconds"
  )
  @task.execute
end