vahmed-hamdy commented on code in PR #24014:
URL: https://github.com/apache/flink/pull/24014#discussion_r1452519304
##########
flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriterTest.java:
##########
@@ -112,16 +112,20 @@ public void checkLoggedSendTimesAreWithinBounds() throws
IOException, Interrupte
AsyncSinkWriterImpl sink =
new AsyncSinkWriterImplBuilder()
.context(sinkInitContext)
- .maxBatchSize(4)
- .delay(100)
+ .maxBatchSize(2)
+ .delay(50)
.build();
- for (int i = 0; i < 4; i++) {
- sink.write(String.valueOf(i));
- }
+ sink.write(String.valueOf(1));
+ // introduce artificial delay, shouldn't be calculated in send time
+ Thread.sleep(50);
Review Comment:
Hi @pnowojski
`sink.flush()` in fact waits for the async things to complete.
This is in fact why we are adding a sleep (this has nothing to do with
production code at all). We are testing that SendTime Metric calculation
measures time of sending (in this case flush) so we simulate a delay between
writing and flushing.
This is an alternative to having an estimate upper bound that is affected by
mailbox delays and the reason behind the test flakiness before.
I thought the comment explained that :D
--
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]