Skip to content

Commit d1ceed7

Browse files
skeptrunedevcdxker
authored andcommitted
cleanup: timeout for uploading a file should be 5 minutes or more unlike other routes
1 parent 2c4613d commit d1ceed7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server/src/middleware/timeout_middleware.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ pub async fn timeout_15secs(
2828
let base_server_url =
2929
std::env::var("BASE_SERVER_URL").unwrap_or_else(|_| "https://api.trieve.ai".to_string());
3030

31-
match tokio::time::timeout(std::time::Duration::from_secs(15), next.call(service_req)).await {
31+
let mut timeout_secs = 15;
32+
if method == "POST" && path == "/api/file" {
33+
timeout_secs = 300;
34+
}
35+
36+
match tokio::time::timeout(
37+
std::time::Duration::from_secs(timeout_secs),
38+
next.call(service_req),
39+
)
40+
.await
41+
{
3242
Ok(res) => res,
3343
Err(_err) => {
3444
let email_body = format!(

0 commit comments

Comments
 (0)