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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06f0c9ae88643e805addf746e68767a2c134f102
4
- data.tar.gz: 06fa59ddd4abe76902128f602c2d778e692bfc28
3
+ metadata.gz: af039ada3c68e5b6a3478a84942b344bc9a229f0
4
+ data.tar.gz: 6f0e9cc0c464b83e0661cd868f4c3d94f00217cb
5
5
  SHA512:
6
- metadata.gz: 9d348163af1c40fce64ca9a13ec579bc09f144540823d7f49a3831dca811e28815edda74bb92c3681832b4050cd5283eccd244c26df9c9229da41d8f60a1b42d
7
- data.tar.gz: 923c97c2f33fcbba4a929154923f0801c1b426dff03a4ac3776b007f1c18129edfe02b171580adf69b3bdc4cfe1b2bf403d41ac4329474551b977178127d2fc7
6
+ metadata.gz: '0817ecf06bf5fbd36852f19d98b317ecf56aa9cf3e052db3bd75e22174c609b3be2541f145dccbc6640e82ebb7247245b75d24561ddfd27e3a1d2c05f4f746a8'
7
+ data.tar.gz: 40bff0316776a450b8e77b5c4cce5364d9fe93cd237cc7ae9c296e198470908616cdba392dbb5aa9dd093eaeeae3096017614f2037adf98bbdeff77a7406aa18
@@ -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-rb)
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).
@@ -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
- set_name!
71
- raised = false
72
- msg = consume_one(timeout)
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
- return nil if !msg
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
- set_name!
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
- @redis.client.call([:client, :setname, @redis.id])
269
+ set_name!
262
270
  setname_attempts += 1
263
271
  retry
264
272
  end
@@ -1,3 +1,3 @@
1
1
  module Rafka
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agis Anastasopoulos