Skip to content

Commit 305534e

Browse files
committed
Remove connects_to explanation from Other config options section
Since it has its own section now.
1 parent 0bf654b commit 305534e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ If processes have no chance of cleaning up before exiting (e.g. if someone pulls
150150

151151
Solid Queue can be configured to run on a different database than the main application.
152152

153-
Configure the `connects_to` option in `config/application.rb` or your environment config like so, where `:solid_queue` is the identifier for your dedicated Solid Queue database.
153+
Configure the `connects_to` option in `config/application.rb` or your environment config, with the custom database configuration that will be used in the abstract `SolidQueue::Record` Active Record model.
154154

155155
```ruby
156-
config.solid_queue.connects_to = { database: { writing: :solid_queue, reading: :solid_queue } }
157-
```
156+
# Use a separate DB for Solid Queue
157+
config.solid_queue.connects_to = { database: { writing: :solid_queue_primary, reading: :solid_queue_replica } }
158+
```
158159

159-
Add the dedicated database configuration to `config/database.yml`, differentiating between the main `:primary` database and the dedicated `:solid_queue` database. Make sure to include the `migrations_paths` for the solid queue database. This is where migration files for Solid Queue tables will reside.
160+
Add the dedicated database configuration to `config/database.yml`, differentiating between the main app's database and the dedicated `solid_queue` database. Make sure to include the `migrations_paths` for the solid queue database. This is where migration files for Solid Queue tables will reside.
160161

161162
```yml
162163
default: &default
@@ -171,10 +172,13 @@ solid_queue: &solid_queue
171172
development:
172173
primary:
173174
<<: *default
174-
database: storage/development.sqlite3
175-
solid_queue:
175+
# ...
176+
solid_queue_primary:
177+
<<: *solid_queue
178+
# ...
179+
solid_queue_replica:
176180
<<: *solid_queue
177-
database: storage/development_solid_queue.sqlite3
181+
# ...
178182
```
179183

180184
Install migrations and specify the dedicated database name with the `DATABASE` option. This will create the Solid Queue migration files in a separate directory, matching the value provided in `migrations_paths` in `config/database.yml`.
@@ -202,12 +206,6 @@ There are several settings that control how Solid Queue works that you can set a
202206
```ruby
203207
-> (exception) { Rails.error.report(exception, handled: false) }
204208
```
205-
- `connects_to`: a custom database configuration that will be used in the abstract `SolidQueue::Record` Active Record model. This is required to use a different database than the main app. For example:
206-
207-
```ruby
208-
# Use a separate DB for Solid Queue
209-
config.solid_queue.connects_to = { database: { writing: :solid_queue_primary, reading: :solid_queue_replica } }
210-
```
211209
- `use_skip_locked`: whether to use `FOR UPDATE SKIP LOCKED` when performing locking reads. This will be automatically detected in the future, and for now, you'd only need to set this to `false` if your database doesn't support it. For MySQL, that'd be versions < 8, and for PostgreSQL, versions < 9.5. If you use SQLite, this has no effect, as writes are sequential.
212210
- `process_heartbeat_interval`: the heartbeat interval that all processes will follow—defaults to 60 seconds.
213211
- `process_alive_threshold`: how long to wait until a process is considered dead after its last heartbeat—defaults to 5 minutes.
@@ -302,7 +300,7 @@ By default, Solid Queue runs in the same DB as your app, and job enqueuing is _n
302300
If you prefer not to rely on this, or avoid relying on it unintentionally, you should make sure that:
303301
- You set [`config.active_job.enqueue_after_transaction_commit`](https://edgeguides.rubyonrails.org/configuring.html#config-active-job-enqueue-after-transaction-commit) to `always`, if you're using Rails 7.2+.
304302
- Or, your jobs relying on specific records are always enqueued on [`after_commit` callbacks](https://guides.rubyonrails.org/active_record_callbacks.html#after-commit-and-after-rollback) or otherwise from a place where you're certain that whatever data the job will use has been committed to the database before the job is enqueued.
305-
- Or, you configure a database for Solid Queue, even if it's the same as your app, ensuring that a different connection on the thread handling requests or running jobs for your app will be used to enqueue jobs. For example:
303+
- Or, you configure a different database for Solid Queue, even if it's the same as your app, ensuring that a different connection on the thread handling requests or running jobs for your app will be used to enqueue jobs. For example:
306304

307305
```ruby
308306
class ApplicationRecord < ActiveRecord::Base

0 commit comments

Comments
 (0)