Allow to get the number of bytes queued in PendingWriteQueue#5516
Closed
normanmaurer wants to merge 1 commit into4.1from
Closed
Allow to get the number of bytes queued in PendingWriteQueue#5516normanmaurer wants to merge 1 commit into4.1from
normanmaurer wants to merge 1 commit into4.1from
Conversation
Member
Author
|
@nmittler @Scottmitch PTAL ... this comes in handy if you want to allocate a ByteBuf that you can merge all writes in. |
| @@ -112,7 +123,6 @@ public void removeAndFailAll(Throwable cause) { | |||
| for (PendingWrite write = head; write != null; write = head) { | |||
| head = tail = null; | |||
| size = 0; | |||
Member
There was a problem hiding this comment.
Should size=0 occur outside of the loop? And should we also be setting bytes here?
Member
There was a problem hiding this comment.
should we also be setting bytes here
+1
Should size=0 occur outside of the loop
IIUC I think this is OK. The loop basically ensures by the time this method exists there will be nothing in the queue ... it is necessary because failing promises may generate more writes. So each loop iteration the queue is emptied, and the loop doesn't terminate until the queue is empty.
Member
Author
There was a problem hiding this comment.
@Scottmitch @nmittler let me fix and pull in.
Motivation: For some use-cases it would be useful to know the number of bytes queued in the PendingWriteQueue without the need to dequeue them. Modifications: Add PendingWriteQueue.bytes(). Result: Be able to get the number of bytes queued.
5d7a922 to
7836375
Compare
Member
Author
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.
Motivation:
For some use-cases it would be useful to know the number of bytes queued in the PendingWriteQueue without the need to dequeue them.
Modifications:
Add PendingWriteQueue.bytes().
Result:
Be able to get the number of bytes queued.