Pull request #78: RED-4515: Fixed wrong logic in removallistener of client caches

Merge in RED/search-service from RED-4515 to master

* commit '487f6c31903da3de22e420b308987d8edb186231':
  RED-4515: Fixed wrong logic in removallistener of client caches
This commit is contained in:
Dominique Eiflaender 2023-04-03 11:23:38 +02:00
commit 0471b7f52c
2 changed files with 4 additions and 4 deletions

View File

@ -54,11 +54,11 @@ public class EsClientCache {
numberOfUsersForSameClient++;
}
}
if(numberOfUsersForSameClient <= 1){
if(numberOfUsersForSameClient == 0){
clientToRemove.shutdown();
log.info("Closed elasticsearch client for tenant {}", removal.getKey());
} else {
log.info("Keeping client open from {} because it is still used by {} other tenants", removal.getKey(), numberOfUsersForSameClient - 1);
log.info("Keeping client open from {} because it is still used by {} other tenants", removal.getKey(), numberOfUsersForSameClient);
}
})

View File

@ -54,11 +54,11 @@ public class OpensearchClientCache {
numberOfUsersForSameClient++;
}
}
if(numberOfUsersForSameClient <= 1){
if(numberOfUsersForSameClient == 0){
clientToRemove.shutdown();
log.info("Closed elasticsearch client for tenant {}", removal.getKey());
} else {
log.info("Keeping client open from {} because it is still used by {} other tenants", removal.getKey(), numberOfUsersForSameClient - 1);
log.info("Keeping client open from {} because it is still used by {} other tenants", removal.getKey(), numberOfUsersForSameClient);
}
})