Skip to content

Commit

Permalink
retry startup sequence on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dvoet committed Sep 19, 2019
1 parent 0555456 commit 8f70618
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ import org.ehcache.config.builders.{CacheConfigurationBuilder, CacheManagerBuild

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.util.control.NonFatal

object Boot extends IOApp with LazyLogging {

def run(args: List[String]): IO[ExitCode] =
startup() *> ExitCode.Success.pure[IO]
(startup() *> ExitCode.Success.pure[IO]).recoverWith {
case NonFatal(t) =>
logger.error("sam failed to start, trying again in 5s", t)
IO.sleep(5 seconds) *> run(args)
}

private def startup(): IO[Unit] = {

Expand Down

0 comments on commit 8f70618

Please sign in to comment.