outboxable 0.1.3 → 0.1.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: 469a8e0dea372c23c827c4bff24fecaed9f4c2921f4d40de8fdbed7225dbd52e
4
- data.tar.gz: 17bd59884f0a7385ae7557b76192ba08aa81e1cd9441730e71dd1bb426a9f60f
3
+ metadata.gz: b38cb12aa426fec3c3756e26af3086680a8efc3ae193245248da9993ae004690
4
+ data.tar.gz: 5fd17529cddb6278ec2fd8c4dcdd356eeccb4555482508098df4d870a84b4fc0
5
5
  SHA512:
6
- metadata.gz: 1419c8437e010866124d4f3bb2edbb126475f4e9c2647f68facbb565dde6c48e2b86eb457716b16fa895d035be0f9954067b30fc79ffeebd8dcebfe275c0fa2e
7
- data.tar.gz: 747042c4e73e79cf0fc114c003f0c8a3499cfcf705f2fcdf98396d211313163048be1e42d71e5cfc2ea65ce34ccda54958eb485b191bd2957a4ff2f057457263
6
+ metadata.gz: 324043345096a4d5c7593cb30602277c6422a8fe3ae18bebd443a8bb535cc5069ab873120f5315e88de9b44f1b54190cc086436d393a8684d75af2f51307ca5b
7
+ data.tar.gz: fbefecb406a8b14f211913861a2dd4fbaa96535ae6c849cb7dfb67f9b01313d290812299a3b5b96ee681b25548ab87c372d411db0d8a53e8926d82f4d5edd29d
data/Gemfile CHANGED
@@ -6,14 +6,11 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
-
10
9
  gem 'rspec', '~> 3.0'
11
-
12
10
  gem 'rubocop-rails', '~> 2.18'
13
11
 
14
12
  group :development, :test do
15
- gem "sidekiq", "~> 7.0", require: true
16
- gem "sidekiq-cron", "~> 1.10"
17
- gem "activesupport", "~> 7.0"
13
+ gem 'activesupport', '~> 7.0'
14
+ gem 'sidekiq', '~> 7.0'
15
+ gem 'sidekiq-cron', '~> 1.10'
18
16
  end
19
-
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- outboxable (0.1.3)
4
+ outboxable (0.1.5)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
@@ -33,7 +33,7 @@ GEM
33
33
  json (2.6.3)
34
34
  minitest (5.18.0)
35
35
  parallel (1.22.1)
36
- parser (3.2.1.0)
36
+ parser (3.2.2.0)
37
37
  ast (~> 2.4.1)
38
38
  raabro (1.4.0)
39
39
  rack (2.2.6.4)
@@ -53,21 +53,21 @@ GEM
53
53
  rspec-expectations (3.12.2)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
55
  rspec-support (~> 3.12.0)
56
- rspec-mocks (3.12.3)
56
+ rspec-mocks (3.12.5)
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
58
  rspec-support (~> 3.12.0)
59
59
  rspec-support (3.12.0)
60
- rubocop (1.48.0)
60
+ rubocop (1.49.0)
61
61
  json (~> 2.3)
62
62
  parallel (~> 1.10)
63
63
  parser (>= 3.2.0.0)
64
64
  rainbow (>= 2.2.2, < 4.0)
65
65
  regexp_parser (>= 1.8, < 3.0)
66
66
  rexml (>= 3.2.5, < 4.0)
67
- rubocop-ast (>= 1.26.0, < 2.0)
67
+ rubocop-ast (>= 1.28.0, < 2.0)
68
68
  ruby-progressbar (~> 1.7)
69
69
  unicode-display_width (>= 2.4.0, < 3.0)
70
- rubocop-ast (1.27.0)
70
+ rubocop-ast (1.28.0)
71
71
  parser (>= 3.2.1.0)
72
72
  rubocop-rails (2.18.0)
73
73
  activesupport (>= 4.2.0)
@@ -104,4 +104,4 @@ DEPENDENCIES
104
104
  sidekiq-cron (~> 1.10)
105
105
 
106
106
  BUNDLED WITH
107
- 2.4.2
107
+ 2.4.7
@@ -6,9 +6,9 @@ module Outboxable
6
6
  def perform
7
7
  Outbox.pending.where(last_attempted_at: [..Time.zone.now, nil]).find_in_batches(batch_size: 100).each do |batch|
8
8
  batch.each do |outbox|
9
- # This is to prevent a job from being retried too many times. Worst-case scenario is 1 minute delay in jobs.
10
- outbox.update(last_attempted_at: 1.minute.from_now)
9
+ # This is to prevent a job from being retried too many times. Worst-case scenario is 1 minute delay in jobs.
11
10
  Outboxable::Worker.perform_async(outbox.id)
11
+ outbox.update(last_attempted_at: 1.minute.from_now, status: :processing)
12
12
  end
13
13
  end
14
14
  end
@@ -29,7 +29,6 @@ module Outboxable
29
29
  return unless confirmed
30
30
 
31
31
  @resource.reload
32
- @resource.increment_attempt
33
32
  @resource.update(status: :published, retry_at: nil)
34
33
  end
35
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Outboxable
4
- VERSION = "0.1.3"
4
+ VERSION = '0.1.5'
5
5
  end
@@ -10,15 +10,13 @@ class Outbox < ApplicationRecord
10
10
  enum size: { single: 0, batch: 1 }
11
11
 
12
12
  # Validations
13
- validates :payload, presence: true
14
- validates :exchange, presence: true
15
- validates :routing_key, presence: true
13
+ validates :payload, :exchange, :routing_key, presence: true
16
14
 
17
15
  # Associations
18
16
  belongs_to :outboxable, polymorphic: true, optional: true
19
17
 
20
18
  def set_last_attempted_at
21
- self.last_attempted_at = Time.zone.now
19
+ self.last_attempted_at = 10.seconds.from_now
22
20
  end
23
21
 
24
22
  def publish
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: 0.1.3
4
+ version: 0.1.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-05 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny