shorter cache and timeout on /status and related endpoints
This commit is contained in:
parent
99d405f7db
commit
372c3c60fd
@ -56,7 +56,7 @@ pub async fn serve(
|
||||
|
||||
let response_cache: ResponseCache = CacheBuilder::new(response_cache_size as u64)
|
||||
.name("frontend_response")
|
||||
.time_to_live(Duration::from_secs(1))
|
||||
.time_to_live(Duration::from_millis(100))
|
||||
.build();
|
||||
|
||||
// TODO: read config for if fastest/versus should be available publicly. default off
|
||||
|
@ -80,7 +80,7 @@ pub async fn health(
|
||||
Extension(cache): Extension<Arc<ResponseCache>>,
|
||||
) -> Result<impl IntoResponse, Web3ProxyError> {
|
||||
let (code, content_type, body) = timeout(
|
||||
Duration::from_secs(3),
|
||||
Duration::from_secs(1),
|
||||
cache.get_with(ResponseCacheKey::Health, async move { _health(app).await }),
|
||||
)
|
||||
.await?;
|
||||
@ -117,7 +117,7 @@ pub async fn backups_needed(
|
||||
Extension(cache): Extension<Arc<ResponseCache>>,
|
||||
) -> Result<impl IntoResponse, Web3ProxyError> {
|
||||
let (code, content_type, body) = timeout(
|
||||
Duration::from_secs(3),
|
||||
Duration::from_secs(1),
|
||||
cache.get_with(ResponseCacheKey::BackupsNeeded, async move {
|
||||
_backups_needed(app).await
|
||||
}),
|
||||
@ -168,7 +168,7 @@ pub async fn status(
|
||||
Extension(cache): Extension<Arc<ResponseCache>>,
|
||||
) -> Result<impl IntoResponse, Web3ProxyError> {
|
||||
let (code, content_type, body) = timeout(
|
||||
Duration::from_secs(3),
|
||||
Duration::from_secs(1),
|
||||
cache.get_with(ResponseCacheKey::Status, async move { _status(app).await }),
|
||||
)
|
||||
.await?;
|
||||
|
Loading…
Reference in New Issue
Block a user