diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/repo/SubscriptionCacheRepo.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/repo/SubscriptionCacheRepo.java index 20f43abab64c6abb45514edc241f8058c4584e2b..d9788610e9713b0edb26b8b936dba824a23bec47 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/repo/SubscriptionCacheRepo.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/repo/SubscriptionCacheRepo.java @@ -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())); } diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/ExternalSubscriptionsManager.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/ExternalSubscriptionsManager.java index 0006c8336d56240d1d902bef3c3050abb260ffd1..2be560afb9bb9df5a9184ae4156bb0f2795f76da 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/ExternalSubscriptionsManager.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/ExternalSubscriptionsManager.java @@ -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)){ diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/SubscriptionServiceGc.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/SubscriptionServiceGc.java index ae1914887178455e7aa0bf7f078bba1b006fb8d9..a89b06e7b714a2f35d72569ec928dcf71db0d63f 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/SubscriptionServiceGc.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/service/SubscriptionServiceGc.java @@ -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); }