Skip to content

Commit

Permalink
Distinguish between busy and business errors
Browse files Browse the repository at this point in the history
tmeout for test
  • Loading branch information
xander42280 committed Apr 4, 2024
1 parent ce351f9 commit c710665
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions service/src/prover_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub async fn split(mut split_task: SplitTask, tls_config: Option<TlsConfig>) ->
};
log::info!("split request {:#?}", request);
let mut grpc_request = Request::new(request);
grpc_request.set_timeout(Duration::from_secs(300));
grpc_request.set_timeout(Duration::from_secs(TASK_TIMEOUT));
let response = client.split_elf(grpc_request).await;
if let Ok(response) = response {
if let Some(response_result) = response.get_ref().result.as_ref() {
Expand All @@ -134,9 +134,6 @@ pub async fn split(mut split_task: SplitTask, tls_config: Option<TlsConfig>) ->
return Some(split_task);
}
}
split_task.state = TASK_STATE_FAILED;
} else {
split_task.state = TASK_STATE_UNPROCESSED;
}
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
Some(split_task)
Expand All @@ -160,7 +157,7 @@ pub async fn prove(mut prove_task: ProveTask, tls_config: Option<TlsConfig>) ->
};
log::info!("prove request {:#?}", request);
let mut grpc_request = Request::new(request);
grpc_request.set_timeout(Duration::from_secs(3000));
grpc_request.set_timeout(Duration::from_secs(TASK_TIMEOUT));
let response = client.prove(grpc_request).await;
if let Ok(response) = response {
if let Some(response_result) = response.get_ref().result.as_ref() {
Expand All @@ -169,9 +166,6 @@ pub async fn prove(mut prove_task: ProveTask, tls_config: Option<TlsConfig>) ->
return Some(prove_task);
}
}
prove_task.state = TASK_STATE_FAILED;
} else {
prove_task.state = TASK_STATE_UNPROCESSED;
}
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
Some(prove_task)
Expand Down Expand Up @@ -200,7 +194,7 @@ pub async fn aggregate_all(
};
log::info!("aggregate request {:#?}", request);
let mut grpc_request = Request::new(request);
grpc_request.set_timeout(Duration::from_secs(3000));
grpc_request.set_timeout(Duration::from_secs(TASK_TIMEOUT));
let response = client.aggregate_all(grpc_request).await;
if let Ok(response) = response {
if let Some(response_result) = response.get_ref().result.as_ref() {
Expand Down Expand Up @@ -233,7 +227,7 @@ pub async fn final_proof(
};
log::info!("final_proof request {:#?}", request);
let mut grpc_request = Request::new(request);
grpc_request.set_timeout(Duration::from_secs(3000));
grpc_request.set_timeout(Duration::from_secs(TASK_TIMEOUT));
let response = client.final_proof(grpc_request).await;
if let Ok(response) = response {
if let Some(response_result) = response.get_ref().result.as_ref() {
Expand Down Expand Up @@ -277,7 +271,7 @@ pub async fn get_task_status(
computed_request_id: task_id.to_owned(),
};
let mut grpc_request = Request::new(request);
grpc_request.set_timeout(Duration::from_secs(30));
grpc_request.set_timeout(Duration::from_secs(TASK_TIMEOUT));
let response = client.get_task_result(grpc_request).await;
if let Ok(response) = response {
if let Some(response_result) = response.get_ref().result.as_ref() {
Expand Down
2 changes: 1 addition & 1 deletion stage/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub const TASK_STATE_PROCESSING: u32 = 2;
pub const TASK_STATE_SUCCESS: u32 = 3;
pub const TASK_STATE_FAILED: u32 = 4;

pub const TASK_TIMEOUT: u64 = 1800;
pub const TASK_TIMEOUT: u64 = 7200;

pub const TASK_TIMEOUT :u64 = 3600;

Expand Down

0 comments on commit c710665

Please sign in to comment.