diff --git a/project/RedisServer.scala b/project/RedisServer.scala index 19042ea5..f223886a 100644 --- a/project/RedisServer.scala +++ b/project/RedisServer.scala @@ -53,12 +53,16 @@ class RedisServer(module: String, port: Int) { println(s"Starting Redis container for '$module' from '$image' image") startContainer() var rc = 1 - while (rc != 0) { + val maxTries = 500 + var counter = 0 + while (rc != 0 && counter < maxTries) { + counter += 1 Thread.sleep(500) rc = Process(isReadyCmd).! if (rc == 0) println(s"Redis container for '$module' started on port $port") else println(s"IsReadyCmd returned $rc") } + if (rc != 0) sys.error(s"Redis container for '$module' could not be started on port $port") } } diff --git a/project/SolrServer.scala b/project/SolrServer.scala index 05727524..654c7565 100644 --- a/project/SolrServer.scala +++ b/project/SolrServer.scala @@ -65,11 +65,15 @@ class SolrServer(module: String, port: Int) { private def waitForCoresToBeReady(): Unit = { var rc = 1 - while (rc != 0) { + val maxTries = 500 + var counter = 0 + while (rc != 0 && counter < maxTries) { + counter += 1 Thread.sleep(500) rc = checkCoresReady if (rc == 0) println(s"Solr container for '$module' ready on port $port") } + if (rc != 0) sys.error("Solr container for '$module' could not be started") } private def checkCoresReady =