Skip to content
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: windows local run + log clarifications #1054

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl Shuttle {

secrets
} else {
trace!("no Secrets.toml was found");
trace!("No secrets were loaded");
Default::default()
};

Expand Down
7 changes: 5 additions & 2 deletions proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,16 @@ pub mod runtime {

// Wait for the spawned process to open the endpoint port.
// Connecting instantly does not give it enough time.
let channel = tokio::time::timeout(Duration::from_millis(500), async move {
let channel = tokio::time::timeout(Duration::from_millis(7000), async move {
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved
let mut ms = 5;
loop {
if let Ok(channel) = conn.connect().await {
break channel;
}
trace!("waiting for runtime endpoint to open");
tokio::time::sleep(Duration::from_millis(5)).await;
// exponential backoff
tokio::time::sleep(Duration::from_millis(ms)).await;
ms *= 2;
}
})
.await
Expand Down
22 changes: 14 additions & 8 deletions runtime/src/alpha/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ mod args;
pub async fn start(loader: impl Loader<ProvisionerFactory> + Send + 'static) {
let args = match Args::parse() {
Ok(args) => args,
Err(_) => {
Err(e) => {
error!("{e}");
let help_str = "[HINT]: Run shuttle with `cargo shuttle run`";
let wrapper_str = "-".repeat(help_str.len());
return println!("{wrapper_str}\n{help_str}\n{wrapper_str}",);
println!("{wrapper_str}\n{help_str}\n{wrapper_str}");
return;
}
};

Expand Down Expand Up @@ -333,7 +335,9 @@ where
match res {
Ok(_) => {
info!("service stopped all on its own");
stopped_tx.send((StopReason::End, String::new())).unwrap();
let _ = stopped_tx
.send((StopReason::End, String::new()))
.map_err(|e| error!("{e}"));
},
Err(error) => {
if error.is_panic() {
Expand All @@ -348,22 +352,24 @@ where

error!(error = msg, "service panicked");

stopped_tx
let _ = stopped_tx
.send((StopReason::Crash, msg))
.unwrap();
.map_err(|e| error!("{e}"));
} else {
error!(%error, "service crashed");
stopped_tx
let _ = stopped_tx
.send((StopReason::Crash, error.to_string()))
.unwrap();
.map_err(|e| error!("{e}"));
}
},
}
},
message = kill_rx => {
match message {
Ok(_) => {
stopped_tx.send((StopReason::Request, String::new())).unwrap();
let _ = stopped_tx
.send((StopReason::Request, String::new()))
.map_err(|e| error!("{e}"));
}
Err(_) => trace!("the sender dropped")
};
Expand Down