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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9045d9f58437a085928ba810ad1c7158c721b868dae4db4849cf209694895a6f
4
- data.tar.gz: 147f241967d1f70c7837216e96dd36e4cf83dafe3f1fec5300467b83678a3227
3
+ metadata.gz: 83aa40028057ee3c18ddff4adb7201c4204fc04ea83411fd0e04169c8030a319
4
+ data.tar.gz: 8030f90e2ce864959326120be50a3ac4bee5c140f54576832563d3c583d2f2a9
5
5
  SHA512:
6
- metadata.gz: 50aac6397bfa33c7cafecc5f93b97801d4731507c4ac7e929667351f0e5802dc06e4966a9ab4f5e975a0e63d1d80f5c614379ab0baa8a4a09681d570ecaa8499
7
- data.tar.gz: dcad50b82ec4a91d4de33cf6106b1b38cb1c03f340dab9c650ade2fb1a7f55b2ee68f2d6c7bfb6c9f04146286b2b9e738169aa78e81936cd5b7cd9a8d918bbf1
6
+ metadata.gz: 3a75c5231d00068eb8094cbd5b6aab3f6b89163e1d17cc410eecf422b114283e4b1f02671f6b2e52c7cc43e5e7441690a6ae9673dd5eb6f8f5e88298e6a5d0e7
7
+ data.tar.gz: 8040e8d1fbd3759ee425569077de27c09fd07e4d16685919b75c5f44a3e8f134cb27a72a25eb978ddba1d3e2e77900cd3d4ee2baee294334b4bedc98c124a5f1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- outboxable (1.0.4)
4
+ outboxable (1.0.5)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Outboxable
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
5
5
  end
@@ -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
- after_save :publish, if: :allow_publish
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
- Outboxable::Worker.perform_async(id)
24
- update(status: :processing, last_attempted_at: 1.minute.from_now, allow_publish: false)
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
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-16 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny