@@ -61,6 +61,8 @@ func Run() error {
6161 return err
6262 }
6363
64+ notifier := startNotifier (ctx , cfg , store , log )
65+
6466 // Terminal streaming: the tmux runtime supplies the PTY-attach command and
6567 // liveness; the CDC broadcaster feeds the session-state channel. The manager
6668 // is handed to httpd, which mounts it at /mux. Raw PTY bytes never flow
@@ -71,6 +73,11 @@ func Run() error {
7173
7274 srv , err := httpd .New (cfg , log , termMgr )
7375 if err != nil {
76+ stop ()
77+ notifier .Stop ()
78+ if cdcErr := cdcPipe .Stop (); cdcErr != nil {
79+ log .Error ("cdc pipeline shutdown" , "err" , cdcErr )
80+ }
7481 return err
7582 }
7683
@@ -79,6 +86,11 @@ func Run() error {
7986 // trigger -> change_log -> poller -> broadcaster.
8087 lcStack , err := startLifecycle (ctx , store , log )
8188 if err != nil {
89+ stop ()
90+ notifier .Stop ()
91+ if cdcErr := cdcPipe .Stop (); cdcErr != nil {
92+ log .Error ("cdc pipeline shutdown" , "err" , cdcErr )
93+ }
8294 return err
8395 }
8496
@@ -98,6 +110,7 @@ func Run() error {
98110 // the LIFO trap (see comment after srv.Run), hence explicit.
99111 stop ()
100112 lcStack .Stop ()
113+ notifier .Stop ()
101114 if cdcErr := cdcPipe .Stop (); cdcErr != nil {
102115 log .Error ("cdc pipeline shutdown" , "err" , cdcErr )
103116 }
@@ -113,6 +126,7 @@ func Run() error {
113126 // runs before the cancel — which would hang any non-signal exit path.
114127 stop ()
115128 lcStack .Stop ()
129+ notifier .Stop ()
116130 if err := cdcPipe .Stop (); err != nil {
117131 log .Error ("cdc pipeline shutdown" , "err" , err )
118132 }
0 commit comments