Sha256: 474d8f0569e22995363922ab3bd911b719a8d5ad0e518627e6c06e1ee4b857f6

Contents?: true

Size: 565 Bytes

Versions: 4

Compression:

Stored size: 565 Bytes

Contents

# frozen_string_literal: true

worker_files = Dir[Rails.root.join('app','workers','**','*_worker.rb').to_s]
require_workers = worker_files.map { |path| File.basename(path, '.rb') }
require_workers.each do |worker|
  require worker
end

workers = ObjectSpace.each_object(Class).select do |klass|
  klass.included_modules.include?(Sidekiq::Worker)
end


while true
  workers.each do |worker|
    sleep(0.5)
    puts worker.perform_async
    sleep(0.5)
    puts worker.perform_at((rand*10).hours.from_now)
  end
end

Dir.glob["#{APP_PATH}/app/workers/**/*_worker.rb"]

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-web_custom-0.6.0 lib/load_random_workers.rb
sidekiq-web_custom-0.5.0 lib/load_random_workers.rb
sidekiq-web_custom-0.4.1 lib/load_random_workers.rb
sidekiq-web_custom-0.4.0 lib/load_random_workers.rb