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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +6 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +5 -5
- data/docker-compose.yml +1 -0
- data/lib/water_drop/producer.rb +3 -1
- data/lib/water_drop/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -4
- metadata.gz.sig +0 -0
- data/lib/water_drop/patches/rdkafka_producer.rb +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e04020bed5a4adb3cb5ed3486367c9bae0b66998b0c25912a699b64e5c348917
|
4
|
+
data.tar.gz: c2ce9c2f9a3169201a66f948b307ab5d4b1c0d5caa130b1dca1e7c2f90db666e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a40f4811e0ae0356980dfec3a0c0847409186b2afcb7d148e3afadb2c879c6ead03fcfe365e2a3cd15ed45ea1bf9afef7bd89567918dfde3d13741044f5ad36e
|
7
|
+
data.tar.gz: ec09878e1db68243141b4d2a751b7841627f38866199680ed8e08910257e28862c620864d5bd27c880e3176c960960040ef37c447841c00718fd6419f56770f1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
114
|
+
2.2.26
|
data/docker-compose.yml
CHANGED
data/lib/water_drop/producer.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/water_drop/version.rb
CHANGED
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.
|
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-
|
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.
|
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)
|