Skip to content
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
12 changes: 6 additions & 6 deletions 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
Expand Up @@ -8,7 +8,7 @@ edition = "2024"

[workspace.dependencies]
async-trait = "0.1.89"
code0-flow = { version = "0.0.30" }
code0-flow = { version = "0.0.31" }
tucana = { version = "0.0.68" }
tokio = { version = "1.44.1", features = ["rt-multi-thread", "signal"] }
log = "0.4.27"
Expand Down
24 changes: 19 additions & 5 deletions crates/taurus/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ use futures_lite::StreamExt;
use log::error;
use prost::Message;
use std::collections::HashMap;
use std::time::Instant;
use std::time::{Duration, Instant};
use taurus_core::context::context::Context;
use taurus_core::context::executor::Executor;
use taurus_core::context::registry::FunctionStore;
use taurus_core::context::signal::Signal;
use tokio::signal;
use tokio::time::sleep;
use tonic_health::pb::health_server::HealthServer;
use tucana::shared::value::Kind;
use tucana::shared::{
Expand Down Expand Up @@ -111,17 +112,30 @@ async fn main() {
None
};

// Optional: dynamic mode sync at startup
if config.mode == DYNAMIC {
FlowUpdateService::from_url(
let definition_service = FlowUpdateService::from_url(
config.aquila_url.clone(),
config.definitions.clone().as_str(),
config.aquila_token.clone(),
)
.await
.send()
.await;

let mut success = false;
let mut count = 1;
while !success {
success = definition_service.send_with_status().await;
if success {
break;
}

log::warn!(
"Updating definitions failed, trying again in 2 secs (retry number {})",
count
);
count += 1;
Comment on lines +123 to +135
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry loop is unbounded (while !success) and blocks the rest of startup. If Aquila/definition updates never succeed, Taurus will hang here and never start processing NATS messages. Consider adding a maximum retry count and/or moving retries to a background task with backoff (and a clear failure mode/config option).

Suggested change
let mut success = false;
let mut count = 1;
while !success {
success = definition_service.send_with_status().await;
if success {
break;
}
log::warn!(
"Updating definitions failed, trying again in 2 secs (retry number {})",
count
);
count += 1;
const MAX_DEFINITION_UPDATE_RETRIES: usize = 5;
let mut success = false;
for attempt in 1..=MAX_DEFINITION_UPDATE_RETRIES {
success = definition_service.send_with_status().await;
if success {
break;
}
if attempt == MAX_DEFINITION_UPDATE_RETRIES {
log::error!(
"Updating definitions failed after {} attempts; aborting startup",
MAX_DEFINITION_UPDATE_RETRIES
);
return;
}
log::warn!(
"Updating definitions failed, trying again in 3 secs (retry {}/{})",
attempt,
MAX_DEFINITION_UPDATE_RETRIES
);

Copilot uses AI. Check for mistakes.
sleep(Duration::from_secs(3)).await;
}
Comment on lines +131 to +137
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message says the next retry is in "2 secs", but the code sleeps for 3 seconds (Duration::from_secs(3)). Align the message and the actual delay to avoid misleading operators.

Copilot uses AI. Check for mistakes.

let usage_service = TaurusRuntimeUsageService::from_url(
config.aquila_url.clone(),
config.aquila_token.clone(),
Expand Down