outboxable 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 405a1ea3f8e989c7aff0ed3ace6326f937d03b3b43ef43bd0806525c5395fa3b
4
- data.tar.gz: bad9de902867a88ed19d6d3acafa47462802773b616e22b11519fda20a95cd38
3
+ metadata.gz: ab43c50794ab0059ec940956619219fc78cfc1fdc2f2e21e78bd7ac5f24f43dd
4
+ data.tar.gz: 7d1f9ac4e934f92b5c257cd1489ee2f9f316998a3b60b6ba8a9d3af18b9baf41
5
5
  SHA512:
6
- metadata.gz: ea956b5ce9a35414f79358d93c4e97aac76daddadf58b8c08409c7ed4e35e1fd89f5e2a49fe412113e7b0cd80a1fb2adb2c58f792a589aba33f1cc18b8b7a32d
7
- data.tar.gz: 219c292602a81fca5899bc7870cf390b2e20c3c38f9047f40620a8de23a2454b02f1e1eca168d3b64bdfb32dd45b747fac078cd7958e26601cac39d3ece56ff4
6
+ metadata.gz: 5811e8e889c56840cff9d4911853f8929cc11b8959e204965bbfff384c7bc914a32daee6d175563921f0332419ab6201528839b548921e24d70d8428b51c23aa
7
+ data.tar.gz: 6f1b34031671e1cf047642d86a37a44e1bf26d9ec0d5a8929923a188d95177f24df264e9dfb0e8c8bf30522308325441d4a192f198daea1a063e606dd4804126
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- outboxable (0.1.6)
4
+ outboxable (0.1.8)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
@@ -8,7 +8,7 @@ module Outboxable
8
8
  batch.each do |outbox|
9
9
  # This is to prevent a job from being retried too many times. Worst-case scenario is 1 minute delay in jobs.
10
10
  Outboxable::Worker.perform_async(outbox.id)
11
- outbox.update(last_attempted_at: 1.minute.from_now, status: :processing)
11
+ outbox.update(last_attempted_at: 1.minute.from_now, status: :processing, allow_publish: false)
12
12
  end
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Outboxable
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.8'
5
5
  end
@@ -1,9 +1,9 @@
1
1
  class Outbox < ApplicationRecord
2
2
  attribute :allow_publish, :boolean, default: true
3
3
 
4
+ before_save :check_publishing
4
5
  # Callbacks
5
6
  before_create :set_last_attempted_at
6
- before_save :check_publishing
7
7
  after_commit :publish, if: :allow_publish?
8
8
  # Enums
9
9
  enum status: { pending: 0, processing: 1, published: 2, failed: 3 }
@@ -21,6 +21,7 @@ class Outbox < ApplicationRecord
21
21
 
22
22
  def publish
23
23
  Outboxable::Worker.perform_async(id)
24
+ update(status: :processing, last_attempted_at: 1.minute.from_now, allow_publish: false)
24
25
  end
25
26
 
26
27
  def check_publishing
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outboxable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brusk Awat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-11 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny