diff options
author | Daniel Colson <danieljamescolson@gmail.com> | 2018-11-03 22:39:18 -0400 |
---|---|---|
committer | Daniel Colson <danieljamescolson@gmail.com> | 2018-11-03 22:39:18 -0400 |
commit | b517347be1e229554093b061bd3fd7dbf9017f6a (patch) | |
tree | e2482010ad0ab83316f2ae55010c4c23bacbc856 /activejob/lib | |
parent | caad9e1080e5b98bc8b3c40c0f2d226a3a9e859a (diff) | |
download | rails-b517347be1e229554093b061bd3fd7dbf9017f6a.tar.gz rails-b517347be1e229554093b061bd3fd7dbf9017f6a.tar.bz2 rails-b517347be1e229554093b061bd3fd7dbf9017f6a.zip |
Allow using queue prefix with a default queue name
Fixes #34366
Currently setting queue_name_prefix will not combine a prefix with the
default_queue_name; it will only affect queue names set with `queue_as`.
With this PR the prefix will affect the default_queue_name as well.
Closes #19831
Currently setting default_queue_name doesn't actually affect the
queue_name default (although default_queue_name does get used if you
pass a falsey `part_name` to `queue_as`). This PR would get
default_queue_name working as expected as well.
Because the queue_name default is now a lambda wrapping the
default_queue_name, rather than the default_queue_name itself, I had to
update one test to use the instance method `#queue_name` (which
`instance_exec`s the value) instead of the class method. I think this
change is OK, since only the instance method is documented.
There was a question about whether we want a `default_queue_name`
configuration. If we want to get rid of it, I would also be happy to
open a PR for that instead. It has been around for a while now, but it
also hasn't really worked for a while now.
r? @matthewd
since you had an opinion about this before
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/queue_name.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activejob/lib/active_job/queue_name.rb b/activejob/lib/active_job/queue_name.rb index 9dc6bc7f2e..7bb1e35181 100644 --- a/activejob/lib/active_job/queue_name.rb +++ b/activejob/lib/active_job/queue_name.rb @@ -34,7 +34,7 @@ module ActiveJob end included do - class_attribute :queue_name, instance_accessor: false, default: default_queue_name + class_attribute :queue_name, instance_accessor: false, default: -> { self.class.default_queue_name } class_attribute :queue_name_delimiter, instance_accessor: false, default: "_" end |