Concurrency issues in search (#23249)

* Fix - 23213 : WebSocketManager Issue on concurrent modification

* Await till consumers comelete the job

---------

Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com>
(cherry picked from commit 080f0d21fb35a5c8a8150dc46592e07c8ecae588)
This commit is contained in:
Mohit Yadav 2025-09-04 22:55:50 +05:30 committed by OpenMetadata Release Bot
parent 4529767aa3
commit 8cee06f583
2 changed files with 4 additions and 5 deletions

View File

@ -756,10 +756,9 @@ public class SearchIndexApp extends AbstractNativeApplication {
private void waitForConsumersToComplete(CountDownLatch consumerLatch)
throws InterruptedException {
boolean finished = consumerLatch.await(5, TimeUnit.MINUTES);
if (!finished) {
LOG.warn("Consumers did not finish within timeout");
}
LOG.info("Waiting for all consumers to complete their work...");
consumerLatch.await(); // Wait indefinitely for consumers to finish all work
LOG.info("All consumers have completed their work");
}
private void handleInterruption(InterruptedException e) throws InterruptedException {

View File

@ -107,7 +107,7 @@ public class WebSocketManager {
userSocketConnections =
activityFeedEndpoints.containsKey(id)
? activityFeedEndpoints.get(id)
: new HashMap<>();
: new ConcurrentHashMap<>();
userSocketConnections.put(socket.getId(), socket);
activityFeedEndpoints.put(id, userSocketConnections);
}