Skip to content

Commit 630e3d6

Browse files
hunterlxtBusyJay
andauthored
Update src/call/server.rs
Co-authored-by: Jay <[email protected]>
1 parent 4ae1d58 commit 630e3d6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/call/server.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,15 @@ macro_rules! impl_stream_sink {
424424
}
425425
}
426426

427-
/// By default the sink works in normal mode, that is, `start_send` always starts to send message
428-
/// immediately. But when the `enhance_batch` is enabled, the stream will be batched together as
429-
/// much as possible. The specific rules are listed below:
430-
/// Set the `buffer_hint` of the non-end message in the stream to true. And set the `buffer_hint`
431-
/// of the last message to false in `poll_flush` only when there is at least one message with the
432-
/// `buffer_hint` false, so that the previously bufferd messages will be sent out.
427+
/// By default it always sends messages with their configured buffer hint. But when the
428+
/// `enhance_batch` is enabled, messages will be batched together as many as possible.
429+
/// The rules are listed as below:
430+
/// - All messages except the last one will be sent with `buffer_hint` set to true.
431+
/// - The last message will also be sent with `buffer_hint` set to true unless all messages are
432+
/// offered with buffer hint set to true.
433+
///
434+
/// No matter `enhance_batch` is true or false, it's recommended to follow the contract of
435+
/// Sink and call `poll_flush` to ensure messages are handled by gRPC C Core.
433436
pub fn enhance_batch(&mut self, flag: bool) {
434437
self.base.enhance_buffer_strategy = flag;
435438
}

0 commit comments

Comments
 (0)