artery 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f1a11d03719b7ed31e9defaab67715e12d45a94bf44d6ef006487345aac4620
4
- data.tar.gz: 8c7293da3839b5da9867b106a8a49c55ecab34aced06c79020ef09e9f8ccdef9
3
+ metadata.gz: e07fd862261dcd6ea03bcdaeaa8ba1105f4acbdbd19a7be3c1a3a475955964a7
4
+ data.tar.gz: bad3ae0d8a661dde23887d06c52ef073f24b43f3774562525094430eb5882a55
5
5
  SHA512:
6
- metadata.gz: eefc0283414fed7b76b869ee6fd5e78d0e755b31f294364d691df36fb840807401c6e883f9cc3da2e7606d2eb239364b582162e71d3aec6f53a782541e38cff9
7
- data.tar.gz: 225827156bb7a3f6db5e1dd90beb5bb1b62d35b9761098f0101f56ed679dda10e978b504b4c5f4a856b90591db455fbdf563ecccd700474115d1e3cd7cfcb071
6
+ metadata.gz: e6e7f7bd693b96dc421b6673ea818515546415c7a016364aff407de07b18e4b76d6a10dd59a34ea9f29b9f5cfddc39ad81fe1f816fa166c2bc135fd8105bf225
7
+ data.tar.gz: 6515ae08facc636e0334b6bddf24d37c4dbf8136d0f90db342771f346c68f302fa114368a707becc2da4e2b868369e05d6db5006971c12e00ad6e34372240b87
@@ -15,7 +15,11 @@ module Artery
15
15
  after_unarchive :artery_on_unarchive
16
16
  end
17
17
 
18
- before_commit :artery_send_pending_notifications
18
+ if artery[:non_atomic_notification]
19
+ after_commit :artery_send_pending_notifications
20
+ else
21
+ before_commit :artery_send_pending_notifications
22
+ end
19
23
  end
20
24
 
21
25
  def artery_on_create
@@ -45,11 +49,22 @@ module Artery
45
49
  end
46
50
 
47
51
  def artery_send_pending_notifications
48
- artery_pending_notifications.each do |action, extra_data|
49
- artery_notify_message(action, extra_data || {})
52
+ attempts = 0
53
+ begin
54
+ artery_pending_notifications.each do |action, extra_data|
55
+ artery_notify_message(action, extra_data || {})
56
+ end
57
+ rescue StandardError => e
58
+ attempts += 1
59
+ retry if self.class.artery[:non_atomic_notification] && attempts <= 3
60
+
61
+ Artery.handle_error Artery::Error.new(
62
+ "Failed to send artery notifications after #{attempts} attempts: #{e.message}",
63
+ original_exception: e
64
+ )
65
+ ensure
66
+ @artery_pending_notifications = nil
50
67
  end
51
- ensure
52
- @artery_pending_notifications = nil
53
68
  end
54
69
  end
55
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Artery
4
- VERSION = '1.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gnuskov