Skip to content

Commit 19988dd

Browse files
tannakartikeyrosa
authored andcommitted
Added enqueue_after_transaction_commit setting
1 parent 5ff6e01 commit 19988dd

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ There are several settings that control how Solid Queue works that you can set a
171171
- `preserve_finished_jobs`: whether to keep finished jobs in the `solid_queue_jobs` table—defaults to `true`.
172172
- `clear_finished_jobs_after`: period to keep finished jobs around, in case `preserve_finished_jobs` is true—defaults to 1 day. **Note:** Right now, there's no automatic cleanup of finished jobs. You'd need to do this by periodically invoking `SolidQueue::Job.clear_finished_in_batches`, but this will happen automatically in the near future.
173173
- `default_concurrency_control_period`: the value to be used as the default for the `duration` parameter in [concurrency controls](#concurrency-controls). It defaults to 3 minutes.
174+
- `enqueue_after_transaction_commit`: it defines weather the job should be enqueued after `after_commit`. [Read more](https://github.com/rails/rails/pull/51426) about it.
174175

175176

176177
## Concurrency controls

lib/active_job/queue_adapters/solid_queue_adapter.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ module QueueAdapters
88
#
99
# Rails.application.config.active_job.queue_adapter = :solid_queue
1010
class SolidQueueAdapter
11+
def enqueue_after_transaction_commit?
12+
SolidQueue.enqueue_after_transaction_commit
13+
end
14+
1115
def enqueue(active_job) # :nodoc:
1216
SolidQueue::Job.enqueue(active_job)
1317
end

lib/solid_queue.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ module SolidQueue
2828

2929
mattr_accessor :shutdown_timeout, default: 5.seconds
3030

31+
mattr_accessor :enqueue_after_transaction_commit, default: false
32+
3133
mattr_accessor :silence_polling, default: true
3234

3335
mattr_accessor :supervisor_pidfile

0 commit comments

Comments
 (0)