ruby-kafka 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75a29f820ca98f548c88dade0cd0ef90957af62bbefdad6d8b936b7b1caa7150
4
- data.tar.gz: 2ab38764b477a9b864c88ebad07439ff7c9839f6af842a7c0b2a1765bab51c2b
3
+ metadata.gz: 950e6f73c5b6fb41427e44152ad455c77de4203c61154f9c57e43fbc271ccd42
4
+ data.tar.gz: 9bc22f6883763ed70242010a4cf56681f6e26d4ac0763a14a0af112967baa273
5
5
  SHA512:
6
- metadata.gz: 9f0f8d10ea6cdbf2aefe814971e5fec67c0349600606dba29f80e576d6d70b0de33da09e7c137509a18cfb2cba842f49e23cac6c1a0f1a989ee82f195a94bb14
7
- data.tar.gz: a11e618d15a5c12e99de7a62d1161c6c464007edb9a1add1267263b806aacad175a599bfe8d6f822af9645277f1d828f02ceaf90a335e712b7f68c3cf2345d83
6
+ metadata.gz: 38b5a863223994c0f162138dbb6fd00f5ad5a922613f706434d2939d67f9a97cffd42fb2c0136c295cb11a8406f09cfe310cdfd7e1bdb49662b66cb60783572c
7
+ data.tar.gz: ddbaf973082ff746a0368ad884ba4eb8a396b43c10da70f4f4cb1b50a1204b0e0f1d329486e24f9aa9659062d85d2a3d46007d57418f825ab0ff11ec72cb5c46
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ Changes and additions to the library will be listed here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## v0.6.1
8
+
9
+ - Fix bug with exponential pausing causing pauses never to stop.
10
+
7
11
  ## v0.6.0
8
12
 
9
13
  - Fetch messages asynchronously (#526).
@@ -162,7 +162,8 @@ module Kafka
162
162
  # @param partition [Integer]
163
163
  # @return [Boolean] true if the partition is paused, false otherwise.
164
164
  def paused?(topic, partition)
165
- pause_for(topic, partition).paused?
165
+ pause = pause_for(topic, partition)
166
+ pause.paused? && !pause.expired?
166
167
  end
167
168
 
168
169
  # Fetches and enumerates the messages in the topics that the consumer group
data/lib/kafka/pause.rb CHANGED
@@ -47,15 +47,11 @@ module Kafka
47
47
  @max_timeout = nil
48
48
  end
49
49
 
50
- # Whether the partition is currently paused.
50
+ # Whether the partition is currently paused. The pause may have expired, in which
51
+ # case {#expired?} should be checked as well.
51
52
  def paused?
52
53
  # This is nil if we're not currently paused.
53
- return false if @started_at.nil?
54
-
55
- # If no timeout is set we pause forever.
56
- return true if @timeout.nil?
57
-
58
- !expired?
54
+ !@started_at.nil?
59
55
  end
60
56
 
61
57
  def pause_duration
@@ -68,7 +64,11 @@ module Kafka
68
64
 
69
65
  # Whether the pause has expired.
70
66
  def expired?
71
- !@timeout.nil? && @clock.now >= ends_at
67
+ # We never expire the pause if timeout is nil.
68
+ return false if @timeout.nil?
69
+
70
+ # Have we passed the end of the pause duration?
71
+ @clock.now >= ends_at
72
72
  end
73
73
 
74
74
  # Resets the pause state, ensuring that the next pause is not exponential.
data/lib/kafka/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kafka
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck