[fix][client] Fix internal receive used wrong timeout type - #15014
Merged
RobertIndie merged 1 commit intoApr 4, 2022
Merged
Conversation
Technoboy-
approved these changes
Apr 4, 2022
RobertIndie
approved these changes
Apr 4, 2022
codelipenghui
pushed a commit
that referenced
this pull request
Apr 19, 2022
### Motivation Currently, when we called `redeliverUnacknowledgedMessages` and consumer use receive with timeout unit is second, the timeout might not work. When we use the second as receive timeout unit like `consumer.receive(3, TimeUnit.SECONDS);`, line 473 will pass a negative timeout to the next `internalReceive` calls, because we are subtracting nanoseconds from seconds. https://github.com/apache/pulsar/blob/f3b87b65c6946eb197c1eece22cff8ff04e16fcb/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L459-L476 ### Modifications * Use the same type to subtract. * Use long type as timeout argument. (cherry picked from commit bdc3024)
Nicklee007
pushed a commit
to Nicklee007/pulsar
that referenced
this pull request
Apr 20, 2022
) ### Motivation Currently, when we called `redeliverUnacknowledgedMessages` and consumer use receive with timeout unit is second, the timeout might not work. When we use the second as receive timeout unit like `consumer.receive(3, TimeUnit.SECONDS);`, line 473 will pass a negative timeout to the next `internalReceive` calls, because we are subtracting nanoseconds from seconds. https://github.com/apache/pulsar/blob/f3b87b65c6946eb197c1eece22cff8ff04e16fcb/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L459-L476 ### Modifications * Use the same type to subtract. * Use long type as timeout argument.
Member
|
After discussing with @Demogorgon314, We don't need to cherry-pick this PR to branch-2.9. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15001
Motivation
Currently, when we called
redeliverUnacknowledgedMessagesand consumer use receive with timeout unit is second, the timeout might not work.When we use the second as receive timeout unit like
consumer.receive(3, TimeUnit.SECONDS);, line 473 will pass a negative timeout to the nextinternalReceivecalls, because we are subtracting nanoseconds from seconds.pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Lines 459 to 476 in f3b87b6
Modifications
Documentation
Check the box below or label this PR directly (if you have committer privilege).
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-docThis is a bug fix, no need for docs.
doc(If this PR contains doc changes)