Remove circular require for resque from resque-scheduler#795
Merged
PatrickTulskie merged 1 commit intoresque:masterfrom Aug 19, 2025
Merged
Remove circular require for resque from resque-scheduler#795PatrickTulskie merged 1 commit intoresque:masterfrom
PatrickTulskie merged 1 commit intoresque:masterfrom
Conversation
Contributor
Author
|
I can't reproduce that one test failure locally, I think it's just flaky and given it's using an EOL version of Ruby and redis v4, I'm not sure it's worth investigating very deeply. https://github.com/resque/resque-scheduler/actions/runs/11624157950/job/32372342214?pr=795#step:5:11 Here's how I tried to repro: |
zzak
added a commit
to zzak/resque
that referenced
this pull request
Nov 1, 2024
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.
Member
|
@zzak If you get a second, can you rebase on master and push this again? I think that instance was fixed in master. |
This resolves the following warning:
```
BUNDLE_GEMFILE=test/gemfiles/Gemfile-rails-main bundle exec rake test:activejob
/home/zzak/.rbenv/versions/3.3.5/bin/ruby -w -I"lib:test:lib:test/active_job" /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/active_job/cases/adapter_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/resque/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/resque/test/active_job/cases/adapter_test.rb:3:in `<top (required)>'
from /home/zzak/code/resque/test/active_job/cases/adapter_test.rb:3:in `require_relative'
from /home/zzak/code/resque/test/active_job/helper.rb:15: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/resque/test/active_job/adapters/resque.rb:3:in `<top (required)>'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:61:in `on_load'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:61:in `each'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:62:in `block in on_loa
d'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:92:in `execute_hook'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:87:in `with_execution_
control'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:97:in `block in execut
e_hook'
from /home/zzak/.rbenv/versions/3.3.5/lib/ruby/gems/3.3.0/bundler/gems/rails-9de4972adee8/activesupport/lib/active_support/lazy_load_hooks.rb:97:in `class_eval'
from /home/zzak/code/resque/test/active_job/adapters/resque.rb:4:in `block 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/resque/lib/active_job/queue_adapters/resque_adapter.rb:7: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/resque-scheduler/lib/resque-scheduler.rb:4: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/resque-scheduler/lib/resque/scheduler/extension.rb:4:in `<top (required)>'
from /home/zzak/code/resque-scheduler/lib/resque/scheduler/extension.rb:4:in `require_relative'
from /home/zzak/code/resque-scheduler/lib/resque/scheduler/delaying_extensions.rb:2: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/resque/lib/resque.rb:27: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'
Run options: --seed 11193
# Running:
.
Finished in 0.002215s, 451.5588 runs/s, 451.5588 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
```
PatrickTulskie
approved these changes
Aug 19, 2025
This was referenced Nov 9, 2025
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves the following warning: