LCOV - code coverage report
Current view: top level - compute_tools/src/http/routes - refresh_configuration.rs (source / functions) Coverage Total Hit
Test: c8f8d331b83562868d9054d9e0e68f866772aeaa.info Lines: 0.0 % 8 0
Test Date: 2025-07-26 17:20:05 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              : 
      11              : use crate::compute::ComputeNode;
      12              : use crate::hadron_metrics::POSTGRES_PAGESTREAM_REQUEST_ERRORS;
      13              : use crate::http::JsonResponse;
      14              : 
      15              : /// The /refresh_configuration POST method is used to nudge compute_ctl to pull a new spec
      16              : /// from the HCC and attempt to reconfigure Postgres with the new spec. The method does not wait
      17              : /// for the reconfiguration to complete. Rather, it simply delivers a signal that will cause
      18              : /// configuration to be reloaded in a best effort manner. Invocation of this method does not
      19              : /// guarantee that a reconfiguration will occur. The caller should consider keep sending this
      20              : /// request while it believes that the compute configuration is out of date.
      21            0 : pub(in crate::http) async fn refresh_configuration(
      22            0 :     State(compute): State<Arc<ComputeNode>>,
      23            0 : ) -> Response {
      24            0 :     POSTGRES_PAGESTREAM_REQUEST_ERRORS.inc();
      25            0 :     match compute.signal_refresh_configuration().await {
      26            0 :         Ok(_) => StatusCode::OK.into_response(),
      27            0 :         Err(e) => JsonResponse::error(StatusCode::INTERNAL_SERVER_ERROR, e),
      28              :     }
      29            0 : }
        

Generated by: LCOV version 2.1-beta