Skip to content

Commit 06c9f54

Browse files
committed
try running on coordinated-shutdown, more logging
1 parent 768bea4 commit 06c9f54

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

thrall/app/ThrallComponents.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import controllers.{AssetsComponents, HealthCheck, ReaperController, ThrallContr
1212
import lib._
1313
import lib.elasticsearch._
1414
import lib.kinesis.{KinesisConfig, ThrallEventConsumer}
15+
import org.apache.pekko.actor.CoordinatedShutdown
1516
import org.apache.pekko.stream.KillSwitch
1617
import play.api.ApplicationLoader.Context
1718
import router.Routes
@@ -73,11 +74,11 @@ class ThrallComponents(context: Context) extends GridComponents(context, new Thr
7374
)
7475

7576
private val streamRunning: Future[Done] = thrallStreamProcessor.run()
77+
streamRunning.onComplete(_ => logger.info("Thrall streams completed"))
7678

77-
applicationLifecycle.addStopHook(() => {
79+
coordinatedShutdown.addTask(CoordinatedShutdown.PhaseServiceRequestsDone, "shutdown-thrall-streams")(() => {
7880
logger.info("thrall stream is closing; saying byebye")
7981
thrallStreamProcessor.killSwitch.shutdown()
80-
8182
streamRunning
8283
})
8384

thrall/app/lib/ThrallStreamProcessor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class ThrallStreamProcessor(
130130

131131
stream.onComplete {
132132
case Failure(exception) => logger.error("Thrall stream completed with failure", exception)
133-
case Success(_) => logger.info("Thrall stream completed with done, probably shutting down")
133+
case Success(Done) => logger.info("Thrall stream completed with done, probably shutting down")
134134
}
135135

136136
stream

0 commit comments

Comments
 (0)