Adds transitionary state

This commit is contained in:
Brusk Awat 2023-04-10 10:31:50 +03:00
parent aaf2f57d06
commit 286d11984b
Signed by: broosk1993
GPG Key ID: 5D20F7E02649F74E
3 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
outboxable (0.1.4) outboxable (0.1.5)
bunny (>= 2.19.0) bunny (>= 2.19.0)
connection_pool (~> 2.3.0) connection_pool (~> 2.3.0)

View File

@ -7,8 +7,8 @@ module Outboxable
Outbox.pending.where(last_attempted_at: [..Time.zone.now, nil]).find_in_batches(batch_size: 100).each do |batch| Outbox.pending.where(last_attempted_at: [..Time.zone.now, nil]).find_in_batches(batch_size: 100).each do |batch|
batch.each do |outbox| batch.each do |outbox|
# This is to prevent a job from being retried too many times. Worst-case scenario is 1 minute delay in jobs. # This is to prevent a job from being retried too many times. Worst-case scenario is 1 minute delay in jobs.
outbox.update(last_attempted_at: 1.minute.from_now)
Outboxable::Worker.perform_async(outbox.id) Outboxable::Worker.perform_async(outbox.id)
outbox.update(last_attempted_at: 1.minute.from_now, status: :processing)
end end
end end
end end

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module Outboxable module Outboxable
VERSION = '0.1.4' VERSION = '0.1.5'
end end