class RedisOnlineIndexingRepository implements OnlineIndexingRepository {

    @Override
    public String getMostFreeServer(ServerGroup group) {
        return redisTransactions.runTransaction(jedis -> {
            return jedis.zrangeByScoreWithScores(this.redisSetName(group), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 0, 1)
                    .stream()
                    .findFirst()
                    .map(Tuple::getElement)
                    .orElseThrow(NoFreeServersException::new);
        });
    }

}