outboxable 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b35b65aa492459dcaf6262e1f1a531eeccdf5a146ba1007d1a47068c55f44337
4
- data.tar.gz: a74c84eed72b6bd893ef6d9afc79917618adc9cde39d5afef5ba83bf99f9dd1d
3
+ metadata.gz: ab43c50794ab0059ec940956619219fc78cfc1fdc2f2e21e78bd7ac5f24f43dd
4
+ data.tar.gz: 7d1f9ac4e934f92b5c257cd1489ee2f9f316998a3b60b6ba8a9d3af18b9baf41
5
5
  SHA512:
6
- metadata.gz: 303468322166f4c59132e3e405d005f1e40e1d36802a493b6ddcd0fed54ab831770a7cc8f19d52f08ecd3c5644181bf9cdb4f46a47c1adc6a39662332da091a1
7
- data.tar.gz: 51c9e821c2b7b908ea9358793d4e0007faabe324f03de74d7dca882a720bc77ecbd2aa0d5933ce360f25403ebb79c780977e8f156e24bf616324587aef8b27b0
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.7'
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,7 +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)
24
+ update(status: :processing, last_attempted_at: 1.minute.from_now, allow_publish: false)
25
25
  end
26
26
 
27
27
  def check_publishing
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outboxable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brusk Awat