@nkat wrote:
Hi there,
I have
akka.coordinated-shutdown.run-by-jvm-shutdown-hook
set true (it’s default).
Akka Streams version 2.5.22.For the following code:
CoordinatedShutdown(system).addTask(CoordinatedShutdown.PhaseBeforeServiceUnbind, "graceful-kill")(() => { killSwitch.shutdown() Future(done()) }) CoordinatedShutdown(system).addTask(CoordinatedShutdown.PhaseBeforeActorSystemTerminate, "wait-streams-finished")(() => { streams.foreach(Await.ready(_, 1.minutes)) Future(done()) }) system.registerOnTermination(db.close()) sys.addShutdownHook { logger.info("Terminating Actor system...") Await.result(system.whenTerminated, Duration.Inf) logger.info("Actor system terminated") }
sometimes the app terminates with both
graceful-kill
andwait-streams-finished
phases executed, and sometimes with onlygraceful-kill
, sometimes with neither. despite the hooksystem.registerOnTermination(db.close())
is always executed and awaited.What am I doing wrong?
Thank you very much.
Posts: 2
Participants: 1