You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-14Lines changed: 12 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,13 +150,14 @@ If processes have no chance of cleaning up before exiting (e.g. if someone pulls
150
150
151
151
Solid Queue can be configured to run on a different database than the main application.
152
152
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.
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.
160
161
161
162
```yml
162
163
default: &default
@@ -171,10 +172,13 @@ solid_queue: &solid_queue
171
172
development:
172
173
primary:
173
174
<<: *default
174
-
database: storage/development.sqlite3
175
-
solid_queue:
175
+
# ...
176
+
solid_queue_primary:
177
+
<<: *solid_queue
178
+
# ...
179
+
solid_queue_replica:
176
180
<<: *solid_queue
177
-
database: storage/development_solid_queue.sqlite3
181
+
# ...
178
182
```
179
183
180
184
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
- `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:
- `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.
212
210
- `process_heartbeat_interval`: the heartbeat interval that all processes will follow—defaults to 60 seconds.
213
211
- `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
302
300
If you prefer not to rely on this, or avoid relying on it unintentionally, you should make sure that:
303
301
- 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+.
304
302
- 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:
0 commit comments