waterdrop 2.0.2 → 2.0.3

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: 24189103d7583fac3c911f4b32244655ffa2cd1b5a95abe0e73dbd4344530c5b
4
- data.tar.gz: b4f5c0e95af559e0a0a929d14a3b56b39c4da5edc9b1d9ffe995e8b1852d9c14
3
+ metadata.gz: e04020bed5a4adb3cb5ed3486367c9bae0b66998b0c25912a699b64e5c348917
4
+ data.tar.gz: c2ce9c2f9a3169201a66f948b307ab5d4b1c0d5caa130b1dca1e7c2f90db666e
5
5
  SHA512:
6
- metadata.gz: bd49152ec9f6325cf58d9d470ed1ccfdb0c5b5d9a899bcdca289500ab56008b1153db35bf90f8e5e167692be8c79cd5bf96bbf66f9f515f97922bb217a0544d5
7
- data.tar.gz: 32b36daf1f26227c58690fea5a6846c7599d1e8859e074ca3f2075cf0effa187cfbb4cb86a50ea22dfe169d3af54fd2e3232e14c569efcaa625f52166f227dbb
6
+ metadata.gz: a40f4811e0ae0356980dfec3a0c0847409186b2afcb7d148e3afadb2c879c6ead03fcfe365e2a3cd15ed45ea1bf9afef7bd89567918dfde3d13741044f5ad36e
7
+ data.tar.gz: ec09878e1db68243141b4d2a751b7841627f38866199680ed8e08910257e28862c620864d5bd27c880e3176c960960040ef37c447841c00718fd6419f56770f1
checksums.yaml.gz.sig CHANGED
Binary file
@@ -29,6 +29,12 @@ jobs:
29
29
  uses: ruby/setup-ruby@v1
30
30
  with:
31
31
  ruby-version: ${{matrix.ruby}}
32
+ - name: Run Kafka with docker-compose
33
+ # We need to give Kafka enough time to start and create all the needed topics, etc
34
+ # If anyone has a better idea on how to do it smart and easily, please contact me
35
+ run: |
36
+ docker-compose up -d
37
+ sleep 5
32
38
  - name: Install latest bundler
33
39
  run: |
34
40
  gem install bundler --no-document
@@ -37,8 +43,6 @@ jobs:
37
43
  run: |
38
44
  bundle config set without development
39
45
  bundle install --jobs 4 --retry 3
40
- - name: Run Kafka with docker-compose
41
- run: docker-compose up -d
42
46
  - name: Run all tests
43
47
  env:
44
48
  GITHUB_COVERAGE: ${{matrix.coverage}}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.0.3 (2021-09-05)
4
+ - Remove rdkafka patch in favour of spec topic pre-creation
5
+ - Do not close client that was never used upon closing producer
6
+
3
7
  ## 2.0.2 (2021-08-13)
4
8
  - Add support for `partition_key`
5
9
  - Switch license from `LGPL-3.0` to `MIT`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.0.2)
4
+ waterdrop (2.0.3)
5
5
  concurrent-ruby (>= 1.1)
6
6
  dry-configurable (~> 0.8)
7
7
  dry-monitor (~> 0.3)
@@ -12,7 +12,7 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (6.1.4)
15
+ activesupport (6.1.4.1)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
@@ -43,7 +43,7 @@ GEM
43
43
  dry-configurable (~> 0.5)
44
44
  dry-core (~> 0.5, >= 0.5)
45
45
  dry-events (~> 0.2)
46
- dry-schema (1.7.0)
46
+ dry-schema (1.7.1)
47
47
  concurrent-ruby (~> 1.0)
48
48
  dry-configurable (~> 0.8, >= 0.8.3)
49
49
  dry-core (~> 0.5, >= 0.5)
@@ -68,7 +68,7 @@ GEM
68
68
  ffi (1.15.3)
69
69
  i18n (1.8.10)
70
70
  concurrent-ruby (~> 1.0)
71
- mini_portile2 (2.6.1)
71
+ mini_portile2 (2.7.0)
72
72
  minitest (5.14.4)
73
73
  rake (13.0.6)
74
74
  rdkafka (0.9.0)
@@ -111,4 +111,4 @@ DEPENDENCIES
111
111
  waterdrop!
112
112
 
113
113
  BUNDLED WITH
114
- 2.2.25
114
+ 2.2.26
data/docker-compose.yml CHANGED
@@ -13,5 +13,6 @@ services:
13
13
  KAFKA_ADVERTISED_PORT: 9092
14
14
  KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
15
15
  KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
16
+ KAFKA_CREATE_TOPICS: 'example_topic:1:1'
16
17
  volumes:
17
18
  - /var/run/docker.sock:/var/run/docker.sock
@@ -107,7 +107,9 @@ module WaterDrop
107
107
 
108
108
  # We should not close the client in several threads the same time
109
109
  # It is safe to run it several times but not exactly the same moment
110
- client.close
110
+ # We also mark it as closed only if it was connected, if not, it would trigger a new
111
+ # connection that anyhow would be immediately closed
112
+ client.close if @client
111
113
 
112
114
  @status.closed!
113
115
  end
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.0.2'
6
+ VERSION = '2.0.3'
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.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -34,7 +34,7 @@ cert_chain:
34
34
  R2P11bWoCtr70BsccVrN8jEhzwXngMyI2gVt750Y+dbTu1KgRqZKp/ECe7ZzPzXj
35
35
  pIy9vHxTANKYVyI4qj8OrFdEM5BQNu8oQpL0iQ==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-08-13 00:00:00.000000000 Z
37
+ date: 2021-09-05 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: concurrent-ruby
@@ -152,7 +152,6 @@ files:
152
152
  - lib/water_drop/instrumentation.rb
153
153
  - lib/water_drop/instrumentation/monitor.rb
154
154
  - lib/water_drop/instrumentation/stdout_listener.rb
155
- - lib/water_drop/patches/rdkafka_producer.rb
156
155
  - lib/water_drop/producer.rb
157
156
  - lib/water_drop/producer/async.rb
158
157
  - lib/water_drop/producer/buffer.rb
@@ -184,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
183
  - !ruby/object:Gem::Version
185
184
  version: '0'
186
185
  requirements: []
187
- rubygems_version: 3.2.25
186
+ rubygems_version: 3.2.26
188
187
  signing_key:
189
188
  specification_version: 4
190
189
  summary: Kafka messaging made easy!
metadata.gz.sig CHANGED
Binary file
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module WaterDrop
4
- # Patches to external components
5
- module Patches
6
- # `Rdkafka::Producer` patches
7
- module RdkafkaProducer
8
- # Errors upon which we want to retry message production
9
- # @note Since production happens async, those errors should only occur when using
10
- # partition_key, thus only then we handle them
11
- RETRYABLES = %w[
12
- leader_not_available
13
- err_not_leader_for_partition
14
- invalid_replication_factor
15
- transport
16
- timed_out
17
- ].freeze
18
-
19
- # How many attempts do we want to make before re-raising the error
20
- MAX_ATTEMPTS = 5
21
-
22
- private_constant :RETRYABLES, :MAX_ATTEMPTS
23
-
24
- # @param args [Object] anything `Rdkafka::Producer#produce` accepts
25
- #
26
- # @note This can be removed once this: https://github.com/appsignal/rdkafka-ruby/issues/163
27
- # is resolved.
28
- def produce(**args)
29
- attempt ||= 0
30
- attempt += 1
31
-
32
- super
33
- rescue Rdkafka::RdkafkaError => e
34
- raise unless args.key?(:partition_key)
35
- # We care only about specific errors
36
- # https://docs.confluent.io/platform/current/clients/librdkafka/html/md_INTRODUCTION.html
37
- raise unless RETRYABLES.any? { |message| e.message.to_s.include?(message) }
38
- raise if attempt > MAX_ATTEMPTS
39
-
40
- max_sleep = 2**attempt / 10.0
41
- sleep rand(0.01..max_sleep)
42
-
43
- retry
44
- end
45
- end
46
- end
47
- end
48
-
49
- Rdkafka::Producer.prepend(WaterDrop::Patches::RdkafkaProducer)