Skip to content

retry sending definitions#201

Merged
raphael-goetz merged 2 commits intomainfrom
#189-retry-sending-definitions
Apr 15, 2026
Merged

retry sending definitions#201
raphael-goetz merged 2 commits intomainfrom
#189-retry-sending-definitions

Conversation

@raphael-goetz
Copy link
Copy Markdown
Member

Resolves: #189

Copilot AI review requested due to automatic review settings April 15, 2026 16:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements retry logic for sending flow definitions so Draco can resend definitions after reconnecting when Sagittarius/Aquila is temporarily unavailable (Issue #189).

Changes:

  • Replace one-shot definitions send with a retry loop that waits between attempts.
  • Update code0-flow dependency from 0.0.30 to 0.0.31 (and lockfile updates).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
crates/base/src/runner.rs Adds retry loop around definitions update during startup.
Cargo.toml Bumps workspace code0-flow version.
Cargo.lock Updates resolved dependency versions/checksums accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/base/src/runner.rs
Comment on lines +95 to +109
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;
sleep(Duration::from_secs(3)).await;
}
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 thread crates/base/src/runner.rs
Comment on lines +103 to +109
log::warn!(
"Updating definitions failed, trying again in 2 secs (retry number {})",
count
);
count += 1;
sleep(Duration::from_secs(3)).await;
}
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.
Comment thread crates/base/src/runner.rs
Comment on lines +95 to +99
let mut success = false;
let mut count = 1;
while !success {
success = definition_service.send_with_status().await;
if success {
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.
@raphael-goetz raphael-goetz merged commit f96d39b into main Apr 15, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retry sending Definitions

2 participants