outboxable 1.0.3 → 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: d6b86cd386f79a70ee20e31ea49d2078df347b515858a8585dfa424a008651f6
4
- data.tar.gz: 53074d0ba82ac19955a754090f788b326221b1e1a487b185fe0aac330fd927f4
3
+ metadata.gz: 83aa40028057ee3c18ddff4adb7201c4204fc04ea83411fd0e04169c8030a319
4
+ data.tar.gz: 8030f90e2ce864959326120be50a3ac4bee5c140f54576832563d3c583d2f2a9
5
5
  SHA512:
6
- metadata.gz: 20f03367d91067dc952bfbc45b4038a4b0e944a695f2a3dae4613ded3e139c655d3af1bb56f0f25148c900f1ebe26de8c52a61b1d1e8dde12c5179ada5c41751
7
- data.tar.gz: 227e6a787c3567b512be1cb1dcf2d66ab532046019fb6f86f6ef4a1f243088388947ab73b00a5f453dd36f2da97e59c24b9a1909514e612ac9cd291a84c28609
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.3)
4
+ outboxable (1.0.5)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
@@ -14,7 +14,7 @@ module Outboxable
14
14
 
15
15
  # Copy initializer into user app
16
16
  def copy_initializer
17
- copy_file('activerecod_initializer.rb', 'config/initializers/z_outboxable.rb') if @orm == 'activerecord'
17
+ copy_file('activerecord_initializer.rb', 'config/initializers/z_outboxable.rb') if @orm == 'activerecord'
18
18
  copy_file('mongoid_initializer.rb', 'config/initializers/z_outboxable.rb') if @orm == 'mongoid'
19
19
  end
20
20
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Outboxable
4
- VERSION = '1.0.3'
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.3
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-14 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