waterdrop 2.6.8 → 2.6.9

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: 58c8488102aefb36da6ba9694231b5d3ee72042fb46e7ba807197e35b505628a
4
- data.tar.gz: 6eab9d007458dfee8a7969e04ec216b915d20c44207319b28a73bda01775b88a
3
+ metadata.gz: a4811e6ec1f3cbea82e4604e95b9cd3deddce9337e9fd935f786bd97d008e914
4
+ data.tar.gz: baf54ded0ca2e0ec90e659c199138a36932cd5e2f8d6afffbfdb6b770ebbd29c
5
5
  SHA512:
6
- metadata.gz: 26e72172752ed70452fced5fc0aad2576ad5ae75c9d41a8a2c022acc19e1d41e4e4e7f50e7781c2e711e749f343ba572edaceca3e635ba2a82c549ee35da774c
7
- data.tar.gz: 05460540c2aa4e0c5a8827003a77057e52c9d6a08ae0f5bace989127b6c234c1b5d8fef82949e6e0acac9c4d981a280b828ca3322a34baf70f6359aa434ba31b
6
+ metadata.gz: 4b2b33cfd43d78ae534c14780accb6193a6ec6ff930168c7c7e2813eb9e2599702c2db923b05793a7366f236e9d51250b07894c7cb11b8f1eca81cb79bafa3b7
7
+ data.tar.gz: bde20c38e6ebbac05db6085381928516c050512adffd9a4a36a14c80edfed9788b8375edc1e058f38d809cf7862d742f4116fe94efca6fddc5bb0242d4ba216f
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.6.9 (2023-10-23)
4
+ - [Improvement] Introduce a `transaction.finished` event to indicate that transaction has finished whether it was aborted or committed.
5
+ - [Improvement] Use `transaction.committed` event to indicate that transaction has been committed.
6
+
3
7
  ## 2.6.8 (2023-10-20)
4
8
  - **[Feature]** Introduce transactions support.
5
9
  - [Improvement] Expand `LoggerListener` to inform about transactions (info level).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.6.8)
4
+ waterdrop (2.6.9)
5
5
  karafka-core (>= 2.2.3, < 3.0.0)
6
6
  zeitwerk (~> 2.3)
7
7
 
@@ -64,9 +64,10 @@ module WaterDrop
64
64
  # option [Numeric] how many seconds should we wait with the backoff on queue having space for
65
65
  # more messages before re-raising the error.
66
66
  setting :wait_timeout_on_queue_full, default: 10
67
-
67
+ # option [Numeric] How long to wait before retrying a retryable transaction related error
68
68
  setting :wait_backoff_on_transaction_command, default: 0.5
69
-
69
+ # option [Numeric] How many times to retry a retryable transaction related error before
70
+ # giving up
70
71
  setting :max_attempts_on_transaction_command, default: 5
71
72
 
72
73
  # option [Boolean] should we send messages. Setting this to false can be really useful when
@@ -145,6 +145,11 @@ module WaterDrop
145
145
  info(event, 'Committing transaction')
146
146
  end
147
147
 
148
+ # @param event [Dry::Events::Event] event that happened with the details
149
+ def on_transaction_finished(event)
150
+ info(event, 'Processing transaction')
151
+ end
152
+
148
153
  private
149
154
 
150
155
  # @return [Boolean] should we report the messages details in the debug mode.
@@ -21,6 +21,7 @@ module WaterDrop
21
21
  transaction.started
22
22
  transaction.committed
23
23
  transaction.aborted
24
+ transaction.finished
24
25
 
25
26
  buffer.flushed_async
26
27
  buffer.flushed_sync
@@ -49,7 +49,7 @@ module WaterDrop
49
49
  return yield if @transaction_mutex.owned?
50
50
 
51
51
  @transaction_mutex.synchronize do
52
- transactional_instrument(:committed) do
52
+ transactional_instrument(:finished) do
53
53
  with_transactional_error_handling(:begin) do
54
54
  transactional_instrument(:started) { client.begin_transaction }
55
55
  end
@@ -65,11 +65,16 @@ module WaterDrop
65
65
  commit || raise(WaterDrop::Errors::AbortTransaction)
66
66
 
67
67
  with_transactional_error_handling(:commit) do
68
- client.commit_transaction
68
+ transactional_instrument(:committed) { client.commit_transaction }
69
69
  end
70
70
 
71
71
  result
72
- rescue StandardError => e
72
+ # We need to handle any interrupt including critical in order not to have the transaction
73
+ # running. This will also handle things like `IRB::Abort`
74
+ #
75
+ # rubocop:disable Lint/RescueException
76
+ rescue Exception => e
77
+ # rubocop:enable Lint/RescueException
73
78
  with_transactional_error_handling(:abort) do
74
79
  transactional_instrument(:aborted) { client.abort_transaction }
75
80
  end
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.6.8'
6
+ VERSION = '2.6.9'
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waterdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.8
4
+ version: 2.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
36
36
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
37
37
  -----END CERTIFICATE-----
38
- date: 2023-10-20 00:00:00.000000000 Z
38
+ date: 2023-10-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
metadata.gz.sig CHANGED
Binary file