[MONDRIAN-1726] Possible deadlock when number of batches exceeds available connections in the pool