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
6 changes: 3 additions & 3 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 @@ -7,7 +7,7 @@ version = "0.0.0"
edition = "2024"

[workspace.dependencies]
code0-flow = { version = "0.0.30" }
code0-flow = { version = "0.0.31" }
tucana = { version = "0.0.68", features = ["aquila"] }
serde_json = { version = "1.0.138" }
log = "0.4.27"
Expand Down
21 changes: 18 additions & 3 deletions crates/base/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::{
traits::{LoadConfig, Server as AdapterServer},
};
use code0_flow::flow_service::FlowUpdateService;
use std::sync::Arc;
use tokio::signal;
use std::{sync::Arc, time::Duration};
use tokio::{signal, time::sleep};
use tonic::transport::Server;
use tonic_health::pb::health_server::HealthServer;
use tucana::shared::{AdapterConfiguration, RuntimeFeature};
Expand Down Expand Up @@ -91,7 +91,22 @@ impl<C: LoadConfig> ServerRunner<C> {
config.aquila_token.clone(),
)
.await;
definition_service.send().await;

let mut success = false;
let mut count = 1;
while !success {
success = definition_service.send_with_status().await;
if success {
Comment on lines +95 to +99
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.

while !success { ... if success { break; } } is redundant and makes the loop harder to read. Consider using a loop {} with a single break when the send succeeds (or returning early), which also avoids tracking success separately.

Suggested change
let mut success = false;
let mut count = 1;
while !success {
success = definition_service.send_with_status().await;
if success {
let mut count = 1;
loop {
if definition_service.send_with_status().await {

Copilot uses AI. Check for mistakes.
break;
}

log::warn!(
"Updating definitions failed, trying again in 2 secs (retry number {})",
count
);
count += 1;
sleep(Duration::from_secs(3)).await;
}
Comment on lines +95 to +109
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 for sending definitions runs before the server init/run and before the shutdown signal tokio::select! blocks, so if Aquarius/Sagittarius stays unavailable this can block startup indefinitely and prevent Ctrl+C/SIGTERM from being handled. Consider adding cancellation (e.g., tokio::select! on ctrl_c/sigterm) and/or moving definition retries into a background task with a bounded retry/backoff policy so the process can still start/shutdown cleanly.

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +109
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 seconds, but the code sleeps for 3 seconds. Please make the message and Duration::from_secs(...) consistent so operators can trust the logs.

Copilot uses AI. Check for mistakes.
}

let health_task = if config.with_health_service {
Expand Down