How to close the redisgraph connections

Hi Team,

I’m looking for a template how to close the redisgraph connection obtained from the JedisPool to handle the resource leakage. How can we achieve this on JRedisGraph dependency?

Below is an excerpt of the code that gets the RedisGraph API which is used by other classes to execute queries against the database.

@Configuration
public class Config {
@Bean
public RedisGraph redisGraph() {
JedisPool pool = new JedisPool(new JedisPoolConfig(), host, port, timeout, password);
return new RedisGraph(pool);
}
}

We are then calling the created bean directly to send query to database, this is resulting on resource leakage

@Service
public class Util {
@Autowired
private RedisGraph redisGraph;
public ResultSet redisGraphApi(String query) {
ResultSet resultSet = redisGraph.query(graphId, query);
return resultSet;
}
}

Thanks,

Banu

Hi Banu
I prefer to handle JRedisGraph issues or bugs on GitHub. Can you please open a GitHub issue on this? Can you please provide there the leak log?
Thanks
Dvir