rafka 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/rafka/consumer.rb +20 -12
- data/lib/rafka/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af039ada3c68e5b6a3478a84942b344bc9a229f0
|
4
|
+
data.tar.gz: 6f0e9cc0c464b83e0661cd868f4c3d94f00217cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0817ecf06bf5fbd36852f19d98b317ecf56aa9cf3e052db3bd75e22174c609b3be2541f145dccbc6640e82ebb7247245b75d24561ddfd27e3a1d2c05f4f746a8'
|
7
|
+
data.tar.gz: 40bff0316776a450b8e77b5c4cce5364d9fe93cd237cc7ae9c296e198470908616cdba392dbb5aa9dd093eaeeae3096017614f2037adf98bbdeff77a7406aa18
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ Breaking changes are prefixed with a "[BREAKING]" label.
|
|
5
5
|
## master (unreleased)
|
6
6
|
|
7
7
|
|
8
|
+
## 0.2.2 (2018-05-04)
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
- SETNAME was incorrectly called more than once in batch mode [[3416d7](https://github.com/skroutz/rafka-rb/commit/3416d7bbd9f9e36b4e4d7f87f1e51ba2f559caf2))
|
13
|
+
|
8
14
|
## 0.2.1 (2018-05-04)
|
9
15
|
|
10
16
|
### Fixed
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
rafka-rb
|
2
2
|
===============================================================================
|
3
3
|
[![Build Status](https://api.travis-ci.org/skroutz/rafka-rb.svg?branch=master)](https://travis-ci.org/skroutz/rafka-rb)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/rafka.svg)](https://badge.fury.io/rb/rafka
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/rafka.svg)](https://badge.fury.io/rb/rafka)
|
5
5
|
[![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/skroutz/rafka-rb)
|
6
6
|
|
7
7
|
rafka-rb is a Ruby client library for [Rafka](https://github.com/skroutz/rafka).
|
data/lib/rafka/consumer.rb
CHANGED
@@ -67,14 +67,21 @@ module Rafka
|
|
67
67
|
# @example Consume a message and commit offset if the block does not raise an exception
|
68
68
|
# consumer.consume { |msg| puts "I received #{msg.value}" }
|
69
69
|
def consume(timeout=5)
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
# redis-rb didn't automatically call `CLIENT SETNAME` until v3.2.2
|
71
|
+
# (https://github.com/redis/redis-rb/issues/510)
|
72
|
+
#
|
73
|
+
# TODO(agis): get rid of this when we drop support for 3.2.1 and before
|
74
|
+
if !@redis.client.connected? && Gem::Version.new(Redis::VERSION) < Gem::Version.new("3.2.2")
|
75
|
+
set_name!
|
76
|
+
end
|
73
77
|
|
74
|
-
|
78
|
+
raised = false
|
75
79
|
|
76
80
|
begin
|
81
|
+
msg = consume_one(timeout)
|
77
82
|
yield(msg) if block_given?
|
83
|
+
|
84
|
+
return nil if !msg
|
78
85
|
rescue => e
|
79
86
|
raised = true
|
80
87
|
raise e
|
@@ -128,7 +135,14 @@ module Rafka
|
|
128
135
|
raise ArgumentError, "one of batch_size or batching_max_sec must be greater than 0"
|
129
136
|
end
|
130
137
|
|
131
|
-
|
138
|
+
# redis-rb didn't automatically call `CLIENT SETNAME` until v3.2.2
|
139
|
+
# (https://github.com/redis/redis-rb/issues/510)
|
140
|
+
#
|
141
|
+
# TODO(agis): get rid of this when we drop support for 3.2.1 and before
|
142
|
+
if !@redis.client.connected? && Gem::Version.new(Redis::VERSION) < Gem::Version.new("3.2.2")
|
143
|
+
set_name!
|
144
|
+
end
|
145
|
+
|
132
146
|
raised = false
|
133
147
|
start_time = Time.now
|
134
148
|
msgs = []
|
@@ -222,13 +236,7 @@ module Rafka
|
|
222
236
|
tp
|
223
237
|
end
|
224
238
|
|
225
|
-
# redis-rb didn't automatically call `CLIENT SETNAME` until v3.2.2
|
226
|
-
# (https://github.com/redis/redis-rb/issues/510)
|
227
|
-
#
|
228
|
-
# TODO(agis): get rid of this when we drop support for 3.2.1 and before
|
229
239
|
def set_name!
|
230
|
-
return if @redis.client.connected? || Gem::Version.new(Redis::VERSION) >= Gem::Version.new("3.2.2")
|
231
|
-
|
232
240
|
Rafka.wrap_errors do
|
233
241
|
@redis.client.call([:client, :setname, @redis.id])
|
234
242
|
end
|
@@ -258,7 +266,7 @@ module Rafka
|
|
258
266
|
# TODO(agis): get rid of this when we drop support for 3.2.1 and before
|
259
267
|
if e.message =~ /Identify yourself/ && setname_attempts < 5
|
260
268
|
sleep 0.5
|
261
|
-
|
269
|
+
set_name!
|
262
270
|
setname_attempts += 1
|
263
271
|
retry
|
264
272
|
end
|
data/lib/rafka/version.rb
CHANGED