-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: panic app when cannot send prove #15
Changes from 2 commits
c873b61
a34c60d
fa8cbf6
2fcf5d4
da271bf
4157ef2
0e2abc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ use nexus_core::{ | |
init_circuit_trace, key::CanonicalSerialize, pp::gen_vm_pp, prove_seq_step, types::*, | ||
}, | ||
}; | ||
use std::env; | ||
// use std::env; | ||
use zstd::stream::Encoder; | ||
use rand::{ RngCore }; | ||
|
||
|
@@ -125,10 +125,25 @@ async fn main() { | |
)), | ||
}; | ||
|
||
client | ||
.send(Message::Binary(registration.encode_to_vec())) | ||
.await | ||
.unwrap(); | ||
let mut retries = 0; | ||
let max_retries = 5; | ||
|
||
loop { | ||
if let Err(e) = client.send(Message::Binary(registration.encode_to_vec())).await { | ||
eprintln!("Failed to send message: {:?}, attempt {}/{}", e, retries + 1, max_retries); | ||
|
||
retries += 1; | ||
if retries >= max_retries { | ||
eprintln!("Max retries reached, exiting..."); | ||
break; | ||
} | ||
|
||
// Optionally, add a delay before retrying | ||
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do exponential backoff here? (Multiply sleep delay by 2 each time.) |
||
} else { | ||
break; | ||
} | ||
} | ||
|
||
track( | ||
"register".into(), | ||
|
@@ -261,10 +276,26 @@ async fn main() { | |
}), | ||
); | ||
progress_time = SystemTime::now(); | ||
client | ||
.send(Message::Binary(progress.encode_to_vec())) | ||
.await | ||
.unwrap(); | ||
|
||
let mut retries = 0; | ||
let max_retries = 5; | ||
loop { | ||
if let Err(e) = client.send(Message::Binary(progress.encode_to_vec())).await { | ||
eprintln!("Failed to send message: {:?}, attempt {}/{}", e, retries + 1, max_retries); | ||
|
||
retries += 1; | ||
if retries >= max_retries { | ||
eprintln!("Max retries reached, exiting..."); | ||
break; | ||
} | ||
|
||
// Optionally, add a delay before retrying | ||
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do exponential backoff here? (Multiply sleep delay by 2 each time.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, let me update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something like this, and remove the comment
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated, please help me check and merge. Thank you |
||
} else { | ||
break; | ||
} | ||
} | ||
|
||
if step == end - 1 { | ||
let mut buf = Vec::new(); | ||
let mut writer = Box::new(&mut buf); | ||
|
@@ -323,4 +354,4 @@ async fn main() { | |
&ws_addr_string, | ||
json!({ "prover_id": prover_id }), | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.