Sha256: 486dee7d8c0ef9ed36ca690eb7441451f9b866852d75975d329870e39aa6497a

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

require 'byebug'

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

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq-web_custom-0.3.1 lib/load_random_workers.rb
sidekiq-web_custom-0.3.0 lib/load_random_workers.rb
sidekiq-web_custom-0.2.0 lib/load_random_workers.rb