Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Fix sending lag caused by thread safety
Browse files Browse the repository at this point in the history
  • Loading branch information
315157973 committed Dec 30, 2023
1 parent 59b9218 commit 69ef235
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ public synchronized void run() {
}
// add the topicPartition with timeout error if it's not existed in responseMap
entriesPerPartition.keySet().forEach(topicPartition -> {
if (!responseMap.containsKey(topicPartition)) {
ProduceResponse.PartitionResponse response = responseMap.putIfAbsent(topicPartition,
new ProduceResponse.PartitionResponse(Errors.REQUEST_TIMED_OUT));
if (response == null) {
log.error("Adding dummy REQUEST_TIMED_OUT to produce response for {}", topicPartition);
responseMap.put(topicPartition, new ProduceResponse.PartitionResponse(Errors.REQUEST_TIMED_OUT));
}
});
if (log.isDebugEnabled()) {
Expand Down

0 comments on commit 69ef235

Please sign in to comment.