Skip to content

Deprecation warning with Rails 7.1 #425

@fragkakis

Description

@fragkakis

Hello, thank you for the library!

With rails 7.1 I get the following deprecation warning:

WarningHandlers::Rails::Deprecation: DEPRECATION WARNING: `clear_active_connections!` currently only applies to connection pools in the current role (`writing`). In Rails 7.2, this method will apply to all known pools, regardless of role. To affect only those connections belonging to a specific role, pass the role name as an argument. To switch to the new behavior, pass `:all` as the role name. (called from run_job_middleware at (eval):11)

The stack trace is the following:

  "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.2/lib/active_record/connection_adapters/abstract/connection_handler.rb:187:in `clear_active_connections!'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/activerecord-7.1.3.2/lib/active_record/connection_handling.rb:321:in `clear_active_connections!'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/active_record/connection.rb:45:in `call'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/utils/middleware.rb:36:in `invoke_middleware'",
      "(eval):11:in `run_job_middleware'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/worker.rb:103:in `work_job'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/worker.rb:76:in `work_loop'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/que-2.3.0/lib/que/worker.rb:46:in `block in initialize'",
      "/home/workable/app/vendor/bundle/ruby/3.2.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'"

I noticed there are 2 occasions of clear_active_connections! called in que without an argument, so I guess both should be handled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions