Skip to content
Snippets Groups Projects
Commit e88de9dc authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

remove not necessary while loop

parent f51b1846
No related branches found
No related tags found
1 merge request!462Fix GC caching, and enable baremetal int tests.
Pipeline #233107 failed
...@@ -112,18 +112,16 @@ public class SubscriptionCacheRepo { ...@@ -112,18 +112,16 @@ public class SubscriptionCacheRepo {
private HashSet<Subscription> getSubscriptions(String pattern) { private HashSet<Subscription> getSubscriptions(String pattern) {
ScanOptions options = ScanOptions.scanOptions() ScanOptions options = ScanOptions.scanOptions()
.match(pattern) .match(pattern)
.count(10)
.build(); .build();
boolean done = false;
HashSet<String> keys = new HashSet<>(); HashSet<String> keys = new HashSet<>();
while (!done) {
try (Cursor<String> scan = redisTemplate.scan(options)) { try (Cursor<String> cursor = redisTemplate.scan(options)) {
while (scan.hasNext()) { while (cursor.hasNext()) {
keys.add(scan.next()); keys.add(cursor.next());
}
} }
done = true;
} }
return new HashSet<>(Optional.ofNullable(redisTemplate.opsForValue().multiGet(keys)) return new HashSet<>(Optional.ofNullable(redisTemplate.opsForValue().multiGet(keys))
.orElse(Collections.emptyList())); .orElse(Collections.emptyList()));
} }
......
...@@ -89,8 +89,7 @@ public class ExternalSubscriptionsManager { ...@@ -89,8 +89,7 @@ public class ExternalSubscriptionsManager {
} }
private void reloadSubscriptionInfoCache(String dataPartitionId) { private void reloadSubscriptionInfoCache(String dataPartitionId) {
List<Subscription> fragmentarySubInfos = subscriptionService.getAllSubscriptionInfos( List<Subscription> fragmentarySubInfos = subscriptionService.getAllSubscriptionInfos(dataPartitionId);
dataPartitionId);
for (Subscription freagmentedSubscription : fragmentarySubInfos) { for (Subscription freagmentedSubscription : fragmentarySubInfos) {
Subscription subscription = subscriptionService.getSubscriptionsByNotificationId(dataPartitionId, freagmentedSubscription.getNotificationId()); Subscription subscription = subscriptionService.getSubscriptionsByNotificationId(dataPartitionId, freagmentedSubscription.getNotificationId());
if(Objects.isNull(subscription)){ if(Objects.isNull(subscription)){
......
...@@ -45,7 +45,7 @@ public class SubscriptionServiceGc { ...@@ -45,7 +45,7 @@ public class SubscriptionServiceGc {
if (response.isSuccessCode()) { if (response.isSuccessCode()) {
try { try {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(response.getBody(), new TypeReference<List<Subscription>>(){}); return objectMapper.readValue(response.getBody(), new TypeReference<>() {});
} catch (IOException ex) { } catch (IOException ex) {
throw new SubscriptionException("Exception in deserializing response", response, ex); throw new SubscriptionException("Exception in deserializing response", response, ex);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment