def Leader.on_signal

bend-kube-runtime@0.2.0.0 · src/leader.bend:162

import bend-kube-runtime@0.2.0.0/src/leader.bend as Leader
import Base
import bend-kube-runtime@0.2.0.0/src/config.bend as K
import bend-kube-runtime@0.2.0.0/src/sys.bend as Y
import bend-kube-runtime@0.2.0.0/src/log.bend as L

162# On SIGTERM or SIGINT: release the lease, then exit 0.
163def Leader.on_signal(+cfg: K.Config, +o: LOpts) -> IO(Unit):
164  IO.bind(U32, Unit, Y.Sys.signal(),
165    sig => IO.bind(Unit, Unit, L.Log.info("terminating", [L.Log.kv("signal", U32.show(sig))]),
166      u => IO.bind(Unit, Unit, Leader.release(cfg, o), u2 => IO.exit(0))))

Uses (13)

Used by (1)