Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix circular require from Rails AJ adapter
Similar to sidekiq/sidekiq#6477. This resulted in a circular require, which will fail in Rails CI. ``` CI=1 bundle exec rake test:integration:resque /home/zzak/.rbenv/versions/3.3.5/bin/ruby -w -I"lib:test" /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb "test/integration/queuing_test.rb" Using resque /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75: warning: /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75: warning: loading in progress, circular require considered harmful - /home/zzak/code/rails/activejob/lib/active_job/queue_adapters/resque_adapter.rb from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb:6:in `<main>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb:6:in `select' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/rake-13.2.1/lib/rake/rake_test_loader.rb:21:in `block in <main>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' from /home/zzak/code/rails/activejob/test/integration/queuing_test.rb:3:in `<top (required)>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' from /home/zzak/code/rails/activejob/test/helper.rb:13:in `<top (required)>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' from /home/zzak/code/rails/activejob/test/support/integration/helper.rb:16:in `<top (required)>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' from /tmp/d20241101-2349270-pkyv1o/dummy/config/environment.rb:5:in `<top (required)>' from /home/zzak/code/rails/railties/lib/rails/application.rb:440:in `initialize!' from /home/zzak/code/rails/railties/lib/rails/initializable.rb:60:in `run_initializers' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:208:in `tsort_each' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:229:in `tsort_each' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:350:in `each_strongly_connected_component' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:350:in `call' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:350:in `each' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:352:in `block in each_strongly_connected_component' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:418:in `each_strongly_connected_component_from' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:418:in `call' from /home/zzak/code/rails/railties/lib/rails/initializable.rb:50:in `tsort_each_child' from /home/zzak/code/rails/railties/lib/rails/initializable.rb:50:in `each' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:424:in `block in each_strongly_connected_component_from' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:434:in `each_strongly_connected_component_from' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:425:in `block (2 levels) in each_strongly_connected_component_from' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:353:in `block (2 levels) in each_strongly_connected_component' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/tsort.rb:231:in `block in tsort_each' from /home/zzak/code/rails/railties/lib/rails/initializable.rb:61:in `block in run_initializers' from /home/zzak/code/rails/railties/lib/rails/initializable.rb:32:in `run' from /home/zzak/code/rails/railties/lib/rails/initializable.rb:32:in `instance_exec' from /home/zzak/code/rails/railties/lib/rails/engine.rb:645:in `block in <class:Engine>' from /home/zzak/code/rails/railties/lib/rails/engine.rb:645:in `each' from /home/zzak/code/rails/railties/lib/rails/engine.rb:646:in `block (2 levels) in <class:Engine>' from /home/zzak/code/rails/railties/lib/rails/engine.rb:692:in `load_config_initializer' from /home/zzak/code/rails/activesupport/lib/active_support/notifications.rb:212:in `instrument' from /home/zzak/code/rails/railties/lib/rails/engine.rb:693:in `block in load_config_initializer' from /home/zzak/code/rails/railties/lib/rails/engine.rb:693:in `load' from /tmp/d20241101-2349270-pkyv1o/dummy/config/initializers/activejob.rb:2:in `<main>' from /home/zzak/code/rails/activejob/test/support/integration/adapters/resque.rb:5:in `setup' from /home/zzak/code/rails/activejob/lib/active_job/queue_adapter.rb:52:in `queue_adapter=' from /home/zzak/code/rails/activejob/lib/active_job/queue_adapters.rb:136:in `lookup' from /home/zzak/code/rails/activejob/lib/active_job/queue_adapters.rb:136:in `const_get' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/zeitwerk-2.7.1/lib/zeitwerk/core_ext/kernel.rb:34:in `require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' from /home/zzak/code/rails/activejob/lib/active_job/queue_adapters/resque_adapter.rb:3:in `<main>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/zeitwerk-2.7.1/lib/zeitwerk/core_ext/kernel.rb:34:in `require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' from /home/zzak/code/resque/lib/resque.rb:27:in `<main>' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/zeitwerk-2.7.1/lib/zeitwerk/core_ext/kernel.rb:34:in `require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require' from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/3.3.0/bundled_gems.rb:75:in `require' ``` Interestingly, I started by working on resque/resque-scheduler#795, but after this change that fix no longer seems necessary. Although maybe safe to include anyways, and that PR also fixed the CI.
- Loading branch information