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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/outboxable/polling_publisher_worker.rb +1 -1
- data/lib/outboxable/version.rb +1 -1
- data/lib/templates/outbox.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab43c50794ab0059ec940956619219fc78cfc1fdc2f2e21e78bd7ac5f24f43dd
|
4
|
+
data.tar.gz: 7d1f9ac4e934f92b5c257cd1489ee2f9f316998a3b60b6ba8a9d3af18b9baf41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5811e8e889c56840cff9d4911853f8929cc11b8959e204965bbfff384c7bc914a32daee6d175563921f0332419ab6201528839b548921e24d70d8428b51c23aa
|
7
|
+
data.tar.gz: 6f1b34031671e1cf047642d86a37a44e1bf26d9ec0d5a8929923a188d95177f24df264e9dfb0e8c8bf30522308325441d4a192f198daea1a063e606dd4804126
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/outboxable/version.rb
CHANGED
data/lib/templates/outbox.rb
CHANGED
@@ -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
|