outboxable 1.0.4 → 1.0.5
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/version.rb +1 -1
- data/lib/templates/activerecrod_outbox.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83aa40028057ee3c18ddff4adb7201c4204fc04ea83411fd0e04169c8030a319
|
4
|
+
data.tar.gz: 8030f90e2ce864959326120be50a3ac4bee5c140f54576832563d3c583d2f2a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a75c5231d00068eb8094cbd5b6aab3f6b89163e1d17cc410eecf422b114283e4b1f02671f6b2e52c7cc43e5e7441690a6ae9673dd5eb6f8f5e88298e6a5d0e7
|
7
|
+
data.tar.gz: 8040e8d1fbd3759ee425569077de27c09fd07e4d16685919b75c5f44a3e8f134cb27a72a25eb978ddba1d3e2e77900cd3d4ee2baee294334b4bedc98c124a5f1
|
data/Gemfile.lock
CHANGED
data/lib/outboxable/version.rb
CHANGED
@@ -4,7 +4,7 @@ class Outbox < ApplicationRecord
|
|
4
4
|
before_save :check_publishing
|
5
5
|
# Callbacks
|
6
6
|
before_create :set_last_attempted_at
|
7
|
-
|
7
|
+
after_commit :publish, if: :allow_publish?
|
8
8
|
# Enums
|
9
9
|
enum status: { pending: 0, processing: 1, published: 2, failed: 3 }
|
10
10
|
enum size: { single: 0, batch: 1 }
|
@@ -20,8 +20,12 @@ class Outbox < ApplicationRecord
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def publish
|
23
|
-
|
24
|
-
|
23
|
+
# Run this in own thread
|
24
|
+
threaded = Thread.new do
|
25
|
+
Outboxable::Worker.perform_inline(id)
|
26
|
+
update(status: :processing, last_attempted_at: 1.minute.from_now, allow_publish: false)
|
27
|
+
end
|
28
|
+
threaded.join
|
25
29
|
end
|
26
30
|
|
27
31
|
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: 1.0.
|
4
|
+
version: 1.0.5
|
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
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|