Skip to content

Commit

Permalink
Merge pull request #37 from stakpak/patch/delay
Browse files Browse the repository at this point in the history
Patch: Delay
  • Loading branch information
kajogo777 authored Feb 20, 2025
2 parents 24ffc1b + 86000b1 commit 282ce3e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stakpak"
version = "0.1.37"
version = "0.1.38"
edition = "2021"

[dependencies]
Expand Down
8 changes: 4 additions & 4 deletions src/commands/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Action {
// Ctrl+P
return Err("re-prompt".to_string());
}
print(line);
println!("{}", line);
lines.push(line.to_string());
}
Err(e) => return Err(format!("Failed to read input: {}", e)),
Expand Down Expand Up @@ -254,7 +254,7 @@ impl Action {
}

let confirmation = input.trim().to_lowercase();
print(confirmation.as_str());
println!("{}", confirmation.as_str());

match confirmation.as_str() {
"edit" => {
Expand Down Expand Up @@ -470,7 +470,7 @@ impl<'a> AgentOutputListener<'a> {
let subscription_complete = Arc::new(AtomicBool::new(false));

for retry in 0.. {
sleep(Duration::from_millis(100 * (retry + 1))).await;
sleep(Duration::from_millis(200 * (retry + 1))).await;

let subscription_complete_clone = Arc::clone(&subscription_complete);
let ack_callback =
Expand All @@ -490,7 +490,7 @@ impl<'a> AgentOutputListener<'a> {
)
.await
{
if retry >= 5 {
if retry >= 9 {
return Err(format!("Failed to subscribe to session: {}", e));
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/commands/agent/run_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ pub async fn run_agent(
};
},
false => {
println!(
"\x1b[33m[NOTE: This agent is in non-interactive mode. Use the \x1b[1;32m-i\x1b[33m flag to enable interactive mode.]\x1b[0m"
);

if let Some(flow_ref) = &session.flow_ref {
let url = format!("{}?session_id={}", flow_ref.to_url(), session.id);
println!("\x1b[1;34m{}\x1b[0m", "━".repeat(80));
Expand Down
4 changes: 2 additions & 2 deletions src/commands/flow/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ async fn wait_for_subscription(
let subscription_complete = Arc::new(AtomicBool::new(false));

for retry in 0.. {
sleep(Duration::from_millis(100 * (retry + 1))).await;
sleep(Duration::from_millis(200 * (retry + 1))).await;

let subscription_complete_clone = Arc::clone(&subscription_complete);
let ack_callback = move |_: Payload, _: SocketClient| -> BoxFuture<'static, ()> {
Expand All @@ -344,7 +344,7 @@ async fn wait_for_subscription(
)
.await
{
if retry >= 5 {
if retry >= 9 {
return Err(format!("Failed to subscribe to session: {}", e));
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ pub async fn setup_output_handler(
"session_id": session_id
});

for retry in 0..5 {
for retry in 0..10 {
match socket_client.emit("publish", payload.clone()).await {
Ok(_) => break,
Err(e) => {
if retry == 4 {
if retry == 9 {
eprintln!("Failed to publish message: {}", e);
break;
}
tokio::time::sleep(std::time::Duration::from_millis(100 * (retry + 1)))
tokio::time::sleep(std::time::Duration::from_millis(200 * (retry + 1)))
.await;
}
}
Expand Down

0 comments on commit 282ce3e

Please sign in to comment.