convert waiting for repositories to CountDownLatch too