Reload the PBS state with the latest configuration in the config file Returns 200 if successful or 500 if failed
(state: PbsState<S>)
| 6 | /// Reload the PBS state with the latest configuration in the config file |
| 7 | /// Returns 200 if successful or 500 if failed |
| 8 | pub async fn reload<S: BuilderApiState>(state: PbsState<S>) -> eyre::Result<PbsState<S>> { |
| 9 | let pbs_config = load_pbs_config().await?; |
| 10 | let new_state = PbsState::new(pbs_config).with_data(state.data); |
| 11 | |
| 12 | if state.config.pbs_config.host != new_state.config.pbs_config.host { |
| 13 | warn!( |
| 14 | "Host change for PBS module require a full restart. Old: {}, New: {}", |
| 15 | state.config.pbs_config.host, new_state.config.pbs_config.host |
| 16 | ); |
| 17 | } |
| 18 | |
| 19 | if state.config.pbs_config.port != new_state.config.pbs_config.port { |
| 20 | warn!( |
| 21 | "Port change for PBS module require a full restart. Old: {}, New: {}", |
| 22 | state.config.pbs_config.port, new_state.config.pbs_config.port |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | Ok(new_state) |
| 27 | } |
no test coverage detected