Skip to content

Instantly share code, notes, and snippets.

@andrepiske
Last active March 3, 2025 12:29
Show Gist options
  • Select an option

  • Save andrepiske/e406165f7427a9a8aa40c0140d3ebebd to your computer and use it in GitHub Desktop.

Select an option

Save andrepiske/e406165f7427a9a8aa40c0140d3ebebd to your computer and use it in GitHub Desktop.
sidekiq_workers_meta.rb
# IMPORTANT: when running this in dev mode, you'll have to set eager_load=true in config/application.rb
# Returns all classes that include the Sidekiq::Job module.
worker_classes = []; ink=Module.instance_method(:include?); isa=Object.instance_method(:is_a?); ObjectSpace.each_object { |o| if isa.bind_call(o, Class) && ink.bind_call(o, Sidekiq::Job); worker_classes << o; end }; worker_classes.length
workers_by_queue = worker_classes.group_by{ |x| x.sidekiq_options.with_indifferent_access[:queue] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment