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