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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/kafka/consumer.rb +2 -1
- data/lib/kafka/pause.rb +8 -8
- data/lib/kafka/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 950e6f73c5b6fb41427e44152ad455c77de4203c61154f9c57e43fbc271ccd42
|
4
|
+
data.tar.gz: 9bc22f6883763ed70242010a4cf56681f6e26d4ac0763a14a0af112967baa273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38b5a863223994c0f162138dbb6fd00f5ad5a922613f706434d2939d67f9a97cffd42fb2c0136c295cb11a8406f09cfe310cdfd7e1bdb49662b66cb60783572c
|
7
|
+
data.tar.gz: ddbaf973082ff746a0368ad884ba4eb8a396b43c10da70f4f4cb1b50a1204b0e0f1d329486e24f9aa9659062d85d2a3d46007d57418f825ab0ff11ec72cb5c46
|
data/CHANGELOG.md
CHANGED
data/lib/kafka/consumer.rb
CHANGED
@@ -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)
|
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
|
-
|
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
|
-
|
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