waterdrop 2.7.3 → 2.7.4

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: 83e99f22e3b3099cad3e459f171d7d43ab537fd62c50593997c3297846eb124a
4
- data.tar.gz: 9583295a925fe82e6ca6a6899e0d37f644d0a30cc2a2359289d84ea78ab7e0ec
3
+ metadata.gz: 7829f5c177154b491525c3895e2f12c27c6d58b8e43d47130caf6ee44dc5de2f
4
+ data.tar.gz: bb92b727e921030a5933735f8f1e0e01727fb8e91bc607b1c0adb74031b4881f
5
5
  SHA512:
6
- metadata.gz: 017dd6f279e40d9c2d338e8ea2763fcab70e3ec99c0f229a1fb5c7037765d8f5a00c0dfe2d2ab932623b6b735ca27d9bd3ca3a8f012dd5aff33952f5eaa2b355
7
- data.tar.gz: 6ff18fdd690e8e3f2341e2fa90a28b0972421559e5600c2c1c17b77d31d9882ed0476a3f2f7e6c33844f0b2a71aceb0b7f63bd8e6f8689084a41b6cfc09b6525
6
+ metadata.gz: c7ed272bc46e9f7ea1e398c66588c730f1ca0f7427e7f215d4c89285498e6ccefc1c4af709a1c17f29382e7cc75ebdee403aef865661b8fefdacd164f95acf25
7
+ data.tar.gz: 99d9dcd114f67d272e0d2650ee2bd9aa0b480e9d850fb9f0f32813e02a90603b435b021a27faab09a411f3dea438c9307b14bd12e349289bf977c1b984805604
checksums.yaml.gz.sig CHANGED
Binary file
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.2
1
+ 3.3.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.7.4 (2024-07-04)
4
+ - [Maintenance] Alias `WaterDrop::Errors::AbortTransaction` with `WaterDrop::AbortTransaction`.
5
+ - [Maintenance] Lower the precision reporting to 100 microseconds in the logger listener.
6
+ - [Fix] Consumer consuming error: Local: Erroneous state (state) post break flow in transaction.
7
+ - [Change] Require 'karafka-core' `>= 2.4.3`
8
+
3
9
  ## 2.7.3 (2024-06-09)
4
10
  - [Enhancement] Introduce `reload_on_transaction_fatal_error` to reload the librdkafka after transactional failures
5
11
  - [Enhancement] Flush on fatal transactional errors.
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.7.3)
5
- karafka-core (>= 2.4.0, < 3.0.0)
4
+ waterdrop (2.7.4)
5
+ karafka-core (>= 2.4.3, < 3.0.0)
6
6
  karafka-rdkafka (>= 0.15.1)
7
7
  zeitwerk (~> 2.3)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (7.1.3.3)
12
+ activesupport (7.1.3.4)
13
13
  base64
14
14
  bigdecimal
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -22,24 +22,24 @@ GEM
22
22
  base64 (0.2.0)
23
23
  bigdecimal (3.1.8)
24
24
  byebug (11.1.3)
25
- concurrent-ruby (1.3.1)
25
+ concurrent-ruby (1.3.3)
26
26
  connection_pool (2.4.1)
27
27
  diff-lcs (1.5.1)
28
28
  docile (1.4.0)
29
29
  drb (2.2.1)
30
30
  factory_bot (6.4.6)
31
31
  activesupport (>= 5.0.0)
32
- ffi (1.16.3)
32
+ ffi (1.17.0)
33
33
  i18n (1.14.5)
34
34
  concurrent-ruby (~> 1.0)
35
- karafka-core (2.4.0)
36
- karafka-rdkafka (>= 0.15.0, < 0.16.0)
37
- karafka-rdkafka (0.15.1)
35
+ karafka-core (2.4.3)
36
+ karafka-rdkafka (>= 0.15.0, < 0.17.0)
37
+ karafka-rdkafka (0.16.0)
38
38
  ffi (~> 1.15)
39
39
  mini_portile2 (~> 2.6)
40
40
  rake (> 12)
41
41
  mini_portile2 (2.8.7)
42
- minitest (5.23.1)
42
+ minitest (5.24.0)
43
43
  mutex_m (0.2.0)
44
44
  ostruct (0.6.0)
45
45
  rake (13.2.1)
@@ -49,7 +49,7 @@ GEM
49
49
  rspec-mocks (~> 3.13.0)
50
50
  rspec-core (3.13.0)
51
51
  rspec-support (~> 3.13.0)
52
- rspec-expectations (3.13.0)
52
+ rspec-expectations (3.13.1)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
54
  rspec-support (~> 3.13.0)
55
55
  rspec-mocks (3.13.1)
@@ -64,7 +64,7 @@ GEM
64
64
  simplecov_json_formatter (0.1.4)
65
65
  tzinfo (2.0.6)
66
66
  concurrent-ruby (~> 1.0)
67
- zeitwerk (2.6.15)
67
+ zeitwerk (2.6.16)
68
68
 
69
69
  PLATFORMS
70
70
  ruby
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  waterdrop!
80
80
 
81
81
  BUNDLED WITH
82
- 2.5.11
82
+ 2.5.14
@@ -60,4 +60,8 @@ module WaterDrop
60
60
  end
61
61
  end
62
62
  end
63
+
64
+ # Alias so we can have a nicer API to abort transactions
65
+ # This makes referencing easier
66
+ AbortTransaction = Errors::AbortTransaction
63
67
  end
@@ -193,7 +193,7 @@ module WaterDrop
193
193
  # @param log_message [String] message we want to publish
194
194
  def info(event, log_message)
195
195
  if event.payload.key?(:time)
196
- @logger.info("[#{event[:producer_id]}] #{log_message} took #{event[:time]} ms")
196
+ @logger.info("[#{event[:producer_id]}] #{log_message} took #{event[:time].round(2)} ms")
197
197
  else
198
198
  @logger.info("[#{event[:producer_id]}] #{log_message}")
199
199
  end
@@ -35,7 +35,8 @@ module WaterDrop
35
35
  # with a transaction. One transaction per single dispatch and for `produce_many` it will be
36
36
  # a single transaction wrapping all messages dispatches (not one per message).
37
37
  #
38
- # @return Block result
38
+ # @param block [Proc] block of code that should run
39
+ # @return Block result or `nil` in case of early break/return
39
40
  #
40
41
  # @example Simple transaction
41
42
  # producer.transaction do
@@ -54,7 +55,7 @@ module WaterDrop
54
55
  # end
55
56
  #
56
57
  # handler.wait
57
- def transaction
58
+ def transaction(&block)
58
59
  # This will safely allow us to support one operation transactions so a transactional
59
60
  # producer can work without the transactional block if needed
60
61
  return yield if @transaction_mutex.owned?
@@ -65,13 +66,7 @@ module WaterDrop
65
66
  transactional_instrument(:started) { client.begin_transaction }
66
67
  end
67
68
 
68
- result = nil
69
- commit = false
70
-
71
- catch(:abort) do
72
- result = yield
73
- commit = true
74
- end
69
+ result, commit = transactional_execute(&block)
75
70
 
76
71
  commit || raise(WaterDrop::Errors::AbortTransaction)
77
72
 
@@ -82,15 +77,12 @@ module WaterDrop
82
77
  result
83
78
  # We need to handle any interrupt including critical in order not to have the transaction
84
79
  # running. This will also handle things like `IRB::Abort`
85
- #
86
- # rubocop:disable Lint/RescueException
87
80
  rescue Exception => e
88
81
  # This code is a bit tricky. We have an error and when it happens we try to rollback
89
82
  # the transaction. However we may end up in a state where transaction aborting itself
90
83
  # produces error. In such case we also want to handle it as fatal and reload client.
91
84
  # This is why we catch this here
92
85
  begin
93
- # rubocop:enable Lint/RescueException
94
86
  with_transactional_error_handling(:abort) do
95
87
  transactional_instrument(:aborted) do
96
88
  client.abort_transaction
@@ -176,6 +168,27 @@ module WaterDrop
176
168
  transactional? ? transaction(&block) : yield
177
169
  end
178
170
 
171
+ # Executes the requested code in a transaction with error handling and ensures, that upon
172
+ # early break we rollback the transaction instead of having it dangling and causing an issue
173
+ # where transactional producer would end up in an error state.
174
+ def transactional_execute
175
+ result = nil
176
+ commit = false
177
+
178
+ catch(:abort) do
179
+ result = yield
180
+ commit = true
181
+ end
182
+
183
+ [result, commit]
184
+ rescue Exception => e
185
+ errored = true
186
+
187
+ raise e
188
+ ensure
189
+ return [result, commit] unless errored
190
+ end
191
+
179
192
  # Instruments the transactional operation with producer id
180
193
  #
181
194
  # @param key [Symbol] transaction operation key
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.7.3'
6
+ VERSION = '2.7.4'
7
7
  end
data/waterdrop.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.description = spec.summary
17
17
  spec.license = 'MIT'
18
18
 
19
- spec.add_dependency 'karafka-core', '>= 2.4.0', '< 3.0.0'
19
+ spec.add_dependency 'karafka-core', '>= 2.4.3', '< 3.0.0'
20
20
  spec.add_dependency 'karafka-rdkafka', '>= 0.15.1'
21
21
  spec.add_dependency 'zeitwerk', '~> 2.3'
22
22
 
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.7.3
4
+ version: 2.7.4
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: 2024-06-09 00:00:00.000000000 Z
38
+ date: 2024-07-04 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.4.0
46
+ version: 2.4.3
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.0.0
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 2.4.0
56
+ version: 2.4.3
57
57
  - - "<"
58
58
  - !ruby/object:Gem::Version
59
59
  version: 3.0.0
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.5.9
171
+ rubygems_version: 3.5.11
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Kafka messaging made easy!
metadata.gz.sig CHANGED
Binary file