athena_rs 3.26.3

Hyper performant polyglot Database driver
//! Inbound rate-limit helpers for schema routes.
//!
//! This module owns optional inbound throttling policy for schema endpoints.

use actix_web::{HttpRequest, HttpResponse};

use crate::AppState;
use crate::api::rate_limit::check_inbound_optional;

/// Enforces optional inbound rate limiting for schema endpoints.
pub(in super::super) fn rate_limit_schema(
    req: &HttpRequest,
    app_state: &AppState,
) -> Result<(), HttpResponse> {
    check_inbound_optional(
        &app_state.inbound_rate_limit_schema,
        app_state.inbound_rate_limit_trust_x_forwarded_for,
        req,
    )
}