Closed gczh closed 2 months ago
Hey @gczh, did you run bin/rails db:prepare
after adding the queue
database to database.yml
?
And another question: do you have config.solid_queue.connects_to
set somewhere?
Hey @gczh, did you run
bin/rails db:prepare
after adding thequeue
database todatabase.yml
?
Yep I did!
And another question: do you have
config.solid_queue.connects_to
set somewhere?
I have that setup in both development.rb
and production.rb
. Is it not necessary to specify that if my database.yml
has a multiple database config?
Is it not necessary to specify that if my database.yml has a multiple database config?
Yes, it is, that's why I asked. I saw another person running into trouble because they hadn't set that up š
In any case, apologies, I was replying from my phone yesterday night and didn't properly read and investigate your report š³ In particular this part:
In my
application.rb
, I have the following:# Database config.active_record.writing_role = :primary config.active_record.reading_role = :primary
Note: I have that setup as I have other databases configured in my database.yml and wanted to be explicit that all the app data goes to primary.
After commenting it out, I can verify that the queue is able to connect to the database now. However, I'm wondering if this is the expected behaviour as we should be able to specify those configuration in
application.rb
and it shouldn't affect howsolid_queue
connects to the database?
I think the writing_role
and reading_role
don't work like that. I think these parameters refer to the names of the roles and aren't directly related to one of your databases in particular. According to the docs:
So this means you're setting both these roles to be named primary
, and for Solid Queue, I assume you configured it to be using the default names, writing
and reading
. So it makes sense that when you commented that out, it worked. I think you should leave these two to be the writing
and reading
defaults, and for your app to use the main database, ensure ApplicationRecord
connects to your configured primary
DB.
class ApplicationRecord < ActiveRecord::Base
connects_to database: { writing: :primary, reading: :replica }
Although I don't think this is necessary, Rails will do the right thing without you specifying that.
I'm trying to setup solid_queue for rails 7.2.1 and
I'm getting the error in terminal when i run
bundle exec rails solid_queue:start
In my
database.yml
Running
rails s
works and it's clearly connecting to the primary database.In my
application.rb
, I have the following:Note: I have that setup as I have other databases configured in my database.yml and wanted to be explicit that all the app data goes to primary.
After commenting it out, I can verify that the queue is able to connect to the database now. However, I'm wondering if this is the expected behaviour as we should be able to specify those configuration in
application.rb
and it shouldn't affect howsolid_queue
connects to the database?