diff --git a/src/main/java/com/redislabs/university/RU102J/dao/SiteGeoDaoRedisImpl.java b/src/main/java/com/redislabs/university/RU102J/dao/SiteGeoDaoRedisImpl.java index b3c69bf..d58ae00 100644 --- a/src/main/java/com/redislabs/university/RU102J/dao/SiteGeoDaoRedisImpl.java +++ b/src/main/java/com/redislabs/university/RU102J/dao/SiteGeoDaoRedisImpl.java @@ -33,12 +33,21 @@ public Set findAll() { try (Jedis jedis = jedisPool.getResource()) { Set keys = jedis.zrange(RedisSchema.getSiteGeoKey(), 0, -1); Set sites = new HashSet<>(keys.size()); + + Pipeline p = jedis.pipelined(); + + List>> allResponses = new ArrayList<>(); for (String key : keys) { - Map site = jedis.hgetAll(key); - if (!site.isEmpty()) { - sites.add(new Site(site)); + allResponses.add(p.hgetAll(key)); + } + p.sync(); + + for (Response> response : allResponses) { + if (!response.get().isEmpty()) { + sites.add(new Site(response.get())); } } + return sites; } }