Last active
March 3, 2025 12:29
-
-
Save andrepiske/e406165f7427a9a8aa40c0140d3ebebd to your computer and use it in GitHub Desktop.
sidekiq_workers_meta.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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