Skip to content

Commit

Permalink
network: Make scalatra applications respect DISABLE_WARMUP
Browse files Browse the repository at this point in the history
  • Loading branch information
jnatten committed Nov 2, 2023
1 parent 13b3552 commit 5c5f0a6
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ class NdlaScalatraServer[PropType <: BaseProps, CR <: BaseComponentRegistry[Prop
}

private def warmup(): Unit = {
val warmupStart = System.currentTimeMillis()
logger.info("Starting warmup procedure...")
warmupFunction((path, params) => Warmup.warmupRequest(props.ApplicationPort, path, params))
val warmupTime = System.currentTimeMillis() - warmupStart
logger.info(s"Warmup procedure finished in ${warmupTime}ms.")
componentRegistry.healthController.setWarmedUp()
if (!props.disableWarmup) {
val warmupStart = System.currentTimeMillis()
logger.info("Starting warmup procedure...")
warmupFunction((path, params) => Warmup.warmupRequest(props.ApplicationPort, path, params))
val warmupTime = System.currentTimeMillis() - warmupStart
logger.info(s"Warmup procedure finished in ${warmupTime}ms.")
componentRegistry.healthController.setWarmedUp()
}
}

logCopyrightHeader()
Expand Down

0 comments on commit 5c5f0a6

Please sign in to comment.