Camunda history service and exhausted db connections

Hello, I have problem with Camunda historyService and postgreSQL db connections. I am calling rest api through Postman to use my service where camunda historyService create HistoricTaskInstanceQuery to find specific history instance. It works fine for 10 attempts. The instance is returned but after that, 11 and more times the result is null. I tried to increase pool-size but it didn’t works. Any ideas or someone with similar problem?

The code:

return historyService.createHistoricTaskInstanceQuery()
                .processInstanceId(instance.getId()).singleResult();