mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-25 15:55:15 +00:00
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:
parent
4529767aa3
commit
8cee06f583
@ -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 {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user