Class: Sidekiq::Grouping::Flusher

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/grouping/flusher.rb

Instance Method Summary collapse

Instance Method Details

#flushObject



2
3
4
5
6
7
# File 'lib/sidekiq/grouping/flusher.rb', line 2

def flush
  batches = Sidekiq::Grouping::Batch.all.map do |batch|
    batch if batch.could_flush?
  end
  flush_batches(batches)
end

#force_flush_for_test!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sidekiq/grouping/flusher.rb', line 9

def force_flush_for_test!
  unless Sidekiq::Grouping::Config.tests_env
    Sidekiq::Grouping.logger.warn(
      "**************************************************"
    )
    Sidekiq::Grouping.logger.warn([
      "⛔️ force_flush_for_test! for testing API, ",
      "but this is not the test environment. ",
      "Please check your environment or ",
      "change 'tests_env' to cover this one"
    ].join)
    Sidekiq::Grouping.logger.warn(
      "**************************************************"
    )
  end
  flush_batches(Sidekiq::Grouping::Batch.all)
end