From 286d11984bec2a29608d5e19081dd9b555ca14b5 Mon Sep 17 00:00:00 2001 From: Brusk Awat Date: Mon, 10 Apr 2023 10:31:50 +0300 Subject: [PATCH] Adds transitionary state --- Gemfile.lock | 2 +- lib/outboxable/polling_publisher_worker.rb | 2 +- lib/outboxable/version.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 47107f3..90f43dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - outboxable (0.1.4) + outboxable (0.1.5) bunny (>= 2.19.0) connection_pool (~> 2.3.0) diff --git a/lib/outboxable/polling_publisher_worker.rb b/lib/outboxable/polling_publisher_worker.rb index 4ee51e1..32507b1 100644 --- a/lib/outboxable/polling_publisher_worker.rb +++ b/lib/outboxable/polling_publisher_worker.rb @@ -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| 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. - outbox.update(last_attempted_at: 1.minute.from_now) Outboxable::Worker.perform_async(outbox.id) + outbox.update(last_attempted_at: 1.minute.from_now, status: :processing) end end end diff --git a/lib/outboxable/version.rb b/lib/outboxable/version.rb index b3a4b86..4021175 100644 --- a/lib/outboxable/version.rb +++ b/lib/outboxable/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Outboxable - VERSION = '0.1.4' + VERSION = '0.1.5' end