Skip to content

Commit

Permalink
Improve graceful shutdown (close #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
istreeter committed Dec 6, 2021
1 parent 91b8ee7 commit b7bcfe3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
enableDefaultRedirect = false
enableStartupChecks = true
terminationDeadline = 10.seconds

paths {

Expand Down Expand Up @@ -74,4 +75,4 @@ telemetry {

streams {
useIpAddressAsPartitionKey = false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ trait Collector {
): Future[Unit] =
builder
.bind(rs)
.map(_.addToCoordinatedShutdown(collectorConf.terminationDeadline))
.map { binding =>
log.info(s"REST interface bound to ${binding.localAddress}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ package model {
telemetry: Option[TelemetryConfig],
ssl: SSLConfig = SSLConfig(),
enableDefaultRedirect: Boolean,
enableStartupChecks: Boolean
enableStartupChecks: Boolean,
terminationDeadline: FiniteDuration
) {
val cookieConfig = if (cookie.enabled) Some(cookie) else None
val doNotTrackHttpCookie =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ object TestUtils {
telemetry = None,
prometheusMetrics = PrometheusMetricsConfig(false, None),
enableStartupChecks = true,
enableDefaultRedirect = false
enableDefaultRedirect = false,
terminationDeadline = 10.seconds
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ abstract class ConfigSpec extends Specification {
ssl = SSLConfig(enable = false, redirect = false, port = 443),
enableDefaultRedirect = false,
enableStartupChecks = true,
terminationDeadline = 10.seconds,
streams = StreamsConfig(
good = "good",
bad = "bad",
Expand Down

0 comments on commit b7bcfe3

Please sign in to comment.