Akka scheduled job were not invoked after cluster.leave() called

Hello, I’m using Cluster sharding and akka scheduler.

I found this on https://doc.akka.io/docs/akka/current/cluster-usage.html


All scheduled task will be executed when the ActorSystem is terminated, i.e. the task may execute before its timeout.

but when I call cluster.leave to remove node from cluster, scheduled job were not invoked.

How can I run scheduled job before remove node from cluster?

scheduled job is to send message to actor in cluster before downing node.

Add a task to one of the CoordinatedShutdown phases instead.