Skip to content

Commit

Permalink
added retry in topic deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
adkharat committed Dec 18, 2024
1 parent f364578 commit 203cbe8
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ private void deleteTopic(String topic) {
}
DeleteTopicsResult deleteTopicsResult = adminClient.deleteTopics(Collections.singletonList(topic));
deleteTopicsResult.all().get();
try {
Thread.sleep(1_000); // Wait for metadata propagation
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted while waiting for topic deletion: " + topic, e);
}
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException("Failed to delete topic " + topic, e);
}
Expand Down

0 comments on commit 203cbe8

Please sign in to comment.