waterdrop 2.6.2 → 2.6.4

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: 1ed8c6f17cd730ab82df21e696e472c51dd51379acf757f735d43de98c00dead
4
- data.tar.gz: 10f8b0d7bd64c26ba9b76c9edb76cf59f871cf44adbde2198907856f7b761ea4
3
+ metadata.gz: d70b143a525502bda5fd1ab9d391afa6e5434032179ad169b7a0cf9a1015be8d
4
+ data.tar.gz: c7fd47967967a0ca11e7f791f87eb9475f2d21bd3b3673a57a2c983e91244277
5
5
  SHA512:
6
- metadata.gz: a41f9a5e1ef30c69221615552f48bad03099697d27a1e405f90ab189f6c21a33dedc6382c864d4790a22d798c64023a1802597f8ce255214d077de0ebcd5028b
7
- data.tar.gz: b21a71b53e188fd58ce8800bc23548cc3bbc0a876fe4aa8d9c67107b0e90ddfd6484c4e534137b63e4bb45d5760460ae4b7df79233d6a2acc85ba00d45a55e2a
6
+ metadata.gz: 8dcc38ac6a287417c2f4b0aa65c9f08146ff84d77264b2d12e56201ff1180c9c8f9c3eead2a508341189239d223e1fadb9c126f9e7c0a2b5ebb352ffffdd9dd5
7
+ data.tar.gz: 73deed1c8323285e497f98d6710ddd3e8b890641205556d04f5cf460859efc5a39803f58e4ff5d2a31a1387f6a75b66dc7ddc46573145a30360797ee49fe70fc
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ### 2.6.4 (Unreleased)
4
+ - [Improvement] Use original error `#inspect` for `WaterDrop::Errors::ProduceError` and `WaterDrop::Errors::ProduceManyError` instead of the current empty string.
5
+
6
+ ### 2.6.3 (2023-06-28)
7
+ - [Change] Use `Concurrent::AtomicFixnum` to track operations in progress to prevent potential race conditions on JRuby and TruffleRuby (not yet supported but this is for future usage).
8
+ - [Change] Require `karafka-rdkafka` `>= 0.13.2`.
9
+ - [Change] Require 'karafka-core' `>= 2.1.1`
10
+
3
11
  ### 2.6.2 (2023-06-21)
4
12
  - [Refactor] Introduce a counter-based locking approach to make sure, that we close the producer safely but at the same time not to limit messages production with producing lock.
5
13
  - [Refactor] Make private methods private.
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.6.2)
5
- karafka-core (>= 2.1.0, < 3.0.0)
4
+ waterdrop (2.6.4)
5
+ karafka-core (>= 2.1.1, < 3.0.0)
6
6
  zeitwerk (~> 2.3)
7
7
 
8
8
  GEM
@@ -22,10 +22,10 @@ GEM
22
22
  ffi (1.15.5)
23
23
  i18n (1.14.1)
24
24
  concurrent-ruby (~> 1.0)
25
- karafka-core (2.1.0)
25
+ karafka-core (2.1.1)
26
26
  concurrent-ruby (>= 1.1)
27
- karafka-rdkafka (>= 0.13.0, < 0.14.0)
28
- karafka-rdkafka (0.13.0)
27
+ karafka-rdkafka (>= 0.13.1, < 0.14.0)
28
+ karafka-rdkafka (0.13.2)
29
29
  ffi (~> 1.15)
30
30
  mini_portile2 (~> 2.6)
31
31
  rake (> 12)
@@ -38,8 +38,9 @@ module WaterDrop
38
38
 
39
39
  # @param dispatched [Array<Rdkafka::Producer::DeliveryHandle>] handlers of the
40
40
  # messages that we've dispatched
41
- def initialize(dispatched)
42
- super()
41
+ # @param message [String] error message
42
+ def initialize(dispatched, message)
43
+ super(message)
43
44
  @dispatched = dispatched
44
45
  end
45
46
  end
@@ -22,8 +22,8 @@ module WaterDrop
22
22
  producer_id: id,
23
23
  message: message
24
24
  ) { produce(message) }
25
- rescue *SUPPORTED_FLOW_ERRORS
26
- re_raised = Errors::ProduceError.new
25
+ rescue *SUPPORTED_FLOW_ERRORS => e
26
+ re_raised = Errors::ProduceError.new(e.inspect)
27
27
 
28
28
  @monitor.instrument(
29
29
  'error.occurred',
@@ -62,8 +62,8 @@ module WaterDrop
62
62
 
63
63
  dispatched
64
64
  end
65
- rescue *SUPPORTED_FLOW_ERRORS
66
- re_raised = Errors::ProduceManyError.new(dispatched)
65
+ rescue *SUPPORTED_FLOW_ERRORS => e
66
+ re_raised = Errors::ProduceManyError.new(dispatched, e.inspect)
67
67
 
68
68
  @monitor.instrument(
69
69
  'error.occurred',
@@ -26,8 +26,8 @@ module WaterDrop
26
26
  ) do
27
27
  wait(produce(message))
28
28
  end
29
- rescue *SUPPORTED_FLOW_ERRORS
30
- re_raised = Errors::ProduceError.new
29
+ rescue *SUPPORTED_FLOW_ERRORS => e
30
+ re_raised = Errors::ProduceError.new(e.inspect)
31
31
 
32
32
  @monitor.instrument(
33
33
  'error.occurred',
@@ -69,8 +69,8 @@ module WaterDrop
69
69
 
70
70
  dispatched
71
71
  end
72
- rescue *SUPPORTED_FLOW_ERRORS
73
- re_raised = Errors::ProduceManyError.new(dispatched)
72
+ rescue *SUPPORTED_FLOW_ERRORS => e
73
+ re_raised = Errors::ProduceManyError.new(dispatched, e.inspect)
74
74
 
75
75
  @monitor.instrument(
76
76
  'error.occurred',
@@ -34,7 +34,7 @@ module WaterDrop
34
34
  # @param block [Proc] configuration block
35
35
  # @return [Producer] producer instance
36
36
  def initialize(&block)
37
- @operations_in_progress = 0
37
+ @operations_in_progress = Concurrent::AtomicFixnum.new(0)
38
38
  @buffer_mutex = Mutex.new
39
39
  @connecting_mutex = Mutex.new
40
40
  @operating_mutex = Mutex.new
@@ -138,7 +138,7 @@ module WaterDrop
138
138
 
139
139
  # Wait until all the outgoing operations are done. Only when no one is using the
140
140
  # underlying client running operations we can close
141
- sleep(0.001) until @operations_in_progress.zero?
141
+ sleep(0.001) until @operations_in_progress.value.zero?
142
142
 
143
143
  # Flush has its own buffer mutex but even if it is blocked, flushing can still happen
144
144
  # as we close the client after the flushing (even if blocked by the mutex)
@@ -205,9 +205,9 @@ module WaterDrop
205
205
  # This can happen only during flushing on closing, in case like this we don't have to
206
206
  # synchronize because we already own the lock
207
207
  if @operating_mutex.owned?
208
- @operations_in_progress += 1
208
+ @operations_in_progress.increment
209
209
  else
210
- @operating_mutex.synchronize { @operations_in_progress += 1 }
210
+ @operating_mutex.synchronize { @operations_in_progress.increment }
211
211
  ensure_active!
212
212
  end
213
213
 
@@ -228,7 +228,7 @@ module WaterDrop
228
228
  # the original cause to maintain the same API across all the errors dispatched to the
229
229
  # notifications pipeline.
230
230
  begin
231
- raise Errors::ProduceError
231
+ raise Errors::ProduceError, e.inspect
232
232
  rescue Errors::ProduceError => e
233
233
  # We want to instrument on this event even when we restart it.
234
234
  # The reason is simple: instrumentation and visibility.
@@ -248,10 +248,10 @@ module WaterDrop
248
248
  sleep @config.wait_backoff_on_queue_full
249
249
  end
250
250
 
251
- @operations_in_progress -= 1
251
+ @operations_in_progress.decrement
252
252
  retry
253
253
  ensure
254
- @operations_in_progress -= 1
254
+ @operations_in_progress.decrement
255
255
  end
256
256
  end
257
257
  end
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.6.2'
6
+ VERSION = '2.6.4'
7
7
  end
data/lib/waterdrop.rb CHANGED
@@ -9,6 +9,7 @@
9
9
  securerandom
10
10
  karafka-core
11
11
  pathname
12
+ concurrent/atomic/atomic_fixnum
12
13
  ].each { |lib| require lib }
13
14
 
14
15
  # WaterDrop library
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.1.0', '< 3.0.0'
19
+ spec.add_dependency 'karafka-core', '>= 2.1.1', '< 3.0.0'
20
20
  spec.add_dependency 'zeitwerk', '~> 2.3'
21
21
 
22
22
  if $PROGRAM_NAME.end_with?('gem')
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.2
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-06-21 00:00:00.000000000 Z
38
+ date: 2023-07-11 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.1.0
46
+ version: 2.1.1
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.1.0
56
+ version: 2.1.1
57
57
  - - "<"
58
58
  - !ruby/object:Gem::Version
59
59
  version: 3.0.0
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- E���y���!+t �V� ����5cK|��3��=�$š�x�3KN$ R<�T���=�{60�-�V����=���6���w}�Ff%rZ��������sP��X��)�]��
1
+ ��ǹ��� �2 i3!F�Ftf�x��<�ǧ��ۧ�D�}���{��ƏM�.�F�y-� ��_cx���j)~�w��nG}(����1Ҋ}���݈�jp�ž��GFI���La e�2���su)�3��+��Q2�([I���/���9iE�g���org���X����_��Z�ͥ,�B����c��^�.�I