Skip to content

Allow to get the number of bytes queued in PendingWriteQueue#5516

Closed
normanmaurer wants to merge 1 commit into4.1from
pending_write_queue_bytes
Closed

Allow to get the number of bytes queued in PendingWriteQueue#5516
normanmaurer wants to merge 1 commit into4.1from
pending_write_queue_bytes

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

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.

@normanmaurer
Copy link
Copy Markdown
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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should size=0 occur outside of the loop? And should we also be setting bytes here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
@normanmaurer normanmaurer force-pushed the pending_write_queue_bytes branch from 5d7a922 to 7836375 Compare July 11, 2016 07:04
@normanmaurer
Copy link
Copy Markdown
Member Author

Cherry-picked into 4.0 (ff51dfc) and 4.1 (b37a41a)

@normanmaurer normanmaurer deleted the pending_write_queue_bytes branch July 11, 2016 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants