Skip to content

feat(guardrail): add explicit per-request timeout for Bedrock HTTP call #102

@coderabbitai

Description

@coderabbitai

Summary

The Bedrock guardrail HTTP call in crates/aisix-guardrail/src/guardrails/bedrock.rs currently relies on reqwest's default timeout from Client::new() without an explicit per-request timeout override. Since this guardrail check is latency-sensitive, an explicit timeout should be configured to ensure bounded wait time.

Suggested Fix

Add a per-request .timeout(...) call before .send().await:

let response = self
    .client
    .post(signed.url)
    .headers(signed.headers)
    .timeout(std::time::Duration::from_secs(10))
    .body(body)
    .send()
    .await?;

The specific timeout value (e.g., 5s, 10s) should be decided based on acceptable latency bounds for guardrail checks.

References

Reported by @bzp2010

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions