LCOV - code coverage report
Current view: top level - compute_tools/src/http/routes - refresh_configuration.rs (source / functions) Coverage Total Hit
Test: 915229b2d22dd355ad718d9afbb773e7f2fba970.info Lines: 0.0 % 10 0
Test Date: 2025-07-24 10:33:41 Functions: 0.0 % 2 0

            Line data    Source code
       1              : // This file is added by Hadron
       2              : 
       3              : use std::sync::Arc;
       4              : 
       5              : use axum::{
       6              :     extract::State,
       7              :     response::{IntoResponse, Response},
       8              : };
       9              : use http::StatusCode;
      10              : use tracing::debug;
      11              : 
      12              : use crate::compute::ComputeNode;
      13              : // use crate::hadron_metrics::POSTGRES_PAGESTREAM_REQUEST_ERRORS;
      14              : use crate::http::JsonResponse;
      15              : 
      16              : // The /refresh_configuration POST method is used to nudge compute_ctl to pull a new spec
      17              : // from the HCC and attempt to reconfigure Postgres with the new spec. The method does not wait
      18              : // for the reconfiguration to complete. Rather, it simply delivers a signal that will cause
      19              : // configuration to be reloaded in a best effort manner. Invocation of this method does not
      20              : // guarantee that a reconfiguration will occur. The caller should consider keep sending this
      21              : // request while it believes that the compute configuration is out of date.
      22            0 : pub(in crate::http) async fn refresh_configuration(
      23            0 :     State(compute): State<Arc<ComputeNode>>,
      24            0 : ) -> Response {
      25            0 :     debug!("serving /refresh_configuration POST request");
      26              :     // POSTGRES_PAGESTREAM_REQUEST_ERRORS.inc();
      27            0 :     match compute.signal_refresh_configuration().await {
      28            0 :         Ok(_) => StatusCode::OK.into_response(),
      29            0 :         Err(e) => {
      30            0 :             tracing::error!("error handling /refresh_configuration request: {}", e);
      31            0 :             JsonResponse::error(StatusCode::INTERNAL_SERVER_ERROR, e)
      32              :         }
      33              :     }
      34            0 : }
        

Generated by: LCOV version 2.1-beta