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 {
private HashSet<Subscription> getSubscriptions(String pattern) {
ScanOptions options = ScanOptions.scanOptions()
.match(pattern)
.count(10)
.build();
boolean done = false;
HashSet<String> keys = new HashSet<>();
while (!done) {
try (Cursor<String> scan = redisTemplate.scan(options)) {
while (scan.hasNext()) {
keys.add(scan.next());
}
try (Cursor<String> cursor = redisTemplate.scan(options)) {
while (cursor.hasNext()) {
keys.add(cursor.next());
}
done = true;
}
return new HashSet<>(Optional.ofNullable(redisTemplate.opsForValue().multiGet(keys))
.orElse(Collections.emptyList()));
}
......
......@@ -89,8 +89,7 @@ public class ExternalSubscriptionsManager {
}
private void reloadSubscriptionInfoCache(String dataPartitionId) {
List<Subscription> fragmentarySubInfos = subscriptionService.getAllSubscriptionInfos(
dataPartitionId);
List<Subscription> fragmentarySubInfos = subscriptionService.getAllSubscriptionInfos(dataPartitionId);
for (Subscription freagmentedSubscription : fragmentarySubInfos) {
Subscription subscription = subscriptionService.getSubscriptionsByNotificationId(dataPartitionId, freagmentedSubscription.getNotificationId());
if(Objects.isNull(subscription)){
......
......@@ -45,7 +45,7 @@ public class SubscriptionServiceGc {
if (response.isSuccessCode()) {
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(response.getBody(), new TypeReference<List<Subscription>>(){});
return objectMapper.readValue(response.getBody(), new TypeReference<>() {});
} catch (IOException 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