@@ -248,6 +248,47 @@ impl ProcessManager {
248248 Ok ( StopResult { uuid, state } )
249249 }
250250
251+ pub ( crate ) async fn handle_reload_config (
252+ & self ,
253+ exit_tx : & mpsc:: Sender < ExitEvent > ,
254+ restart_tx : & mpsc:: Sender < PendingRestart > ,
255+ ) -> Result < ReloadResult , Status > {
256+ self . operation_gate
257+ . try_begin ( OperationKind :: ReloadConfig )
258+ . await ?;
259+ let result = self . handle_reload_config_impl ( exit_tx, restart_tx) . await ;
260+ self . operation_gate . end ( OperationKind :: ReloadConfig ) . await ;
261+ result
262+ }
263+
264+ async fn handle_reload_config_impl (
265+ & self ,
266+ exit_tx : & mpsc:: Sender < ExitEvent > ,
267+ restart_tx : & mpsc:: Sender < PendingRestart > ,
268+ ) -> Result < ReloadResult , Status > {
269+ crate :: config_gate:: clear_secret_caches ( ) ;
270+ let new_configs = self . config_loader . load ( ) ;
271+
272+ let removed = self
273+ . remove_and_stop_dropped_config_processes ( & new_configs)
274+ . await ;
275+
276+ let apply = self
277+ . apply_reloaded_config_processes ( new_configs, exit_tx, restart_tx)
278+ . await ;
279+
280+ self . reconcile_processes_after_reload ( & apply, exit_tx, restart_tx)
281+ . await ;
282+
283+ self . update_startup_order ( ) . await ;
284+ Ok ( ReloadResult {
285+ added : apply. added ,
286+ removed,
287+ modified : apply. modified ,
288+ unchanged : apply. unchanged ,
289+ } )
290+ }
291+
251292 async fn update_startup_order ( & self ) -> Vec < String > {
252293 let result = recompute_startup_order ( & self . processes . read ( ) . await ) ;
253294 * self . startup_order . write ( ) . await = result. order ;
0 commit comments