dannycranmer commented on code in PR #21224: URL: https://github.com/apache/flink/pull/21224#discussion_r1012630966
########## flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriter.java: ########## @@ -503,6 +503,10 @@ private void initializeState(Collection<BufferedRequestState<RequestEntryT>> sta for (BufferedRequestState<RequestEntryT> state : states) { initializeState(state); } + + if (bufferedRequestEntries.size() > 0 && !existsActiveTimerCallback) { + registerCallback(); + } } Review Comment: Thanks for looking in to this @vahmed-hamdy . However I think we are duplicating logic here between `initializeState` and `addEntryToBuffer`. Instead of this, I propose we: 1. Delete the `initializeState` method 2. Overload `addEntryToBuffer` to include a version that accepts the `RequestEntryWrapper`, the existing one delegates to new wrapping the `RequestEntryT` 3. Update this method to something that just delegates to `addEntryToBuffer`, such as: ``` states.stream().flatMap(() -> state.getBufferedRequestEntries().stream()).forEach(entry -> addEntryToBuffer(...)); ``` -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org