CrynetLogistics commented on a change in pull request #18651:
URL: https://github.com/apache/flink/pull/18651#discussion_r803573163
##########
File path:
flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriter.java
##########
@@ -267,18 +267,31 @@ private void registerCallback() {
@Override
public void write(InputT element, Context context) throws IOException,
InterruptedException {
+ while (mailboxExecutor.tryYield()) {}
Review comment:
Hi @pnowojski, thanks, just on the questions:
1. There are two types of scenarios where we enqueue to the mailbox (1) to
handle fatal exceptions and (2) to add to the buffer any failed request
entries. I believe, these should take priority over flushing new items?
2. I do agree the line is dubious, perhaps, this is more appropriate: (the
behaviour would remain identical)
```
while (inFlightRequestsCount > 0) {
mailboxExecutor.yield();
}
```
3. Perhaps I'm mistaken, but I don't believe we have a busy loop here. i.e.
if `mailboxExecutor.tryYield()` returns true, there is some work to be
elsewhere in the mailbox, then we perform that. Otherwise, it will return false
and the loop will end. I can't see where CPU resources is being wasted?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]