Skip to content

Commit 4b8699c

Browse files
authored
remove wait_timeout usage warning (#484)
* remove wait_timeout usage warning * remove kern references
1 parent 4824c87 commit 4b8699c

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.17.0 (Unreleased)
44
- [Enhancement] Update `librdkafka` to `2.4.0`
55
- [Feature] Add `#seek_by` to be able to seek for a message by topic, partition and offset (zinahia)
6+
- [Change] Remove old producer timeout API warnings.
67
- [Fix] Switch to local release of librdkafka to mitigate its unavailability.
78

89
## 0.16.1 (2024-07-10)

lib/rdkafka/abstract_handle.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ class AbstractHandle < FFI::Struct
1616
REGISTRY = {}
1717
# Default wait timeout is 31 years
1818
MAX_WAIT_TIMEOUT_FOREVER = 10_000_000_000
19-
# Deprecation message for wait_timeout argument in wait method
20-
WAIT_TIMEOUT_DEPRECATION_MESSAGE = "The 'wait_timeout' argument is deprecated and will be removed in future versions without replacement. " \
21-
"We don't rely on it's value anymore. Please refactor your code to remove references to it."
2219

2320
private_constant :MAX_WAIT_TIMEOUT_FOREVER
2421

@@ -59,16 +56,13 @@ def pending?
5956
#
6057
# @param max_wait_timeout [Numeric, nil] Amount of time to wait before timing out.
6158
# If this is nil we will wait forever
62-
# @param wait_timeout [nil] deprecated
6359
# @param raise_response_error [Boolean] should we raise error when waiting finishes
6460
#
6561
# @return [Object] Operation-specific result
6662
#
6763
# @raise [RdkafkaError] When the operation failed
6864
# @raise [WaitTimeoutError] When the timeout has been reached and the handle is still pending
69-
def wait(max_wait_timeout: 60, wait_timeout: nil, raise_response_error: true)
70-
Kernel.warn(WAIT_TIMEOUT_DEPRECATION_MESSAGE) unless wait_timeout.nil?
71-
65+
def wait(max_wait_timeout: 60, raise_response_error: true)
7266
timeout = max_wait_timeout ? monotonic_now + max_wait_timeout : MAX_WAIT_TIMEOUT_FOREVER
7367

7468
@mutex.synchronize do

spec/rdkafka/abstract_handle_spec.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def create_result
8080
let(:pending_handle) { true }
8181

8282
it "should wait until the timeout and then raise an error" do
83-
expect(Kernel).not_to receive(:warn)
8483
expect {
8584
subject.wait(max_wait_timeout: 0.1)
8685
}.to raise_error Rdkafka::AbstractHandle::WaitTimeoutError, /test_operation/
@@ -90,22 +89,15 @@ def create_result
9089
context 'when pending_handle false' do
9190
let(:pending_handle) { false }
9291

93-
it 'should show a deprecation warning when wait_timeout is set' do
94-
expect(Kernel).to receive(:warn).with(Rdkafka::AbstractHandle::WAIT_TIMEOUT_DEPRECATION_MESSAGE)
95-
subject.wait(wait_timeout: 0.1)
96-
end
97-
9892
context "without error" do
9993
let(:result) { 1 }
10094

10195
it "should return a result" do
102-
expect(Kernel).not_to receive(:warn)
10396
wait_result = subject.wait
10497
expect(wait_result).to eq(result)
10598
end
10699

107100
it "should wait without a timeout" do
108-
expect(Kernel).not_to receive(:warn)
109101
wait_result = subject.wait(max_wait_timeout: nil)
110102
expect(wait_result).to eq(result)
111103
end
@@ -115,7 +107,6 @@ def create_result
115107
let(:response) { 20 }
116108

117109
it "should raise an rdkafka error" do
118-
expect(Kernel).not_to receive(:warn)
119110
expect {
120111
subject.wait
121112
}.to raise_error Rdkafka::RdkafkaError

0 commit comments

Comments
 (0)