-
Notifications
You must be signed in to change notification settings - Fork 0
retry sending definitons #160
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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::{ | ||
|
|
@@ -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; | ||
| sleep(Duration::from_secs(3)).await; | ||
| } | ||
|
Comment on lines
+131
to
+137
|
||
|
|
||
| let usage_service = TaurusRuntimeUsageService::from_url( | ||
| config.aquila_url.clone(), | ||
| config.aquila_token.clone(), | ||
|
|
||
There was a problem hiding this comment.
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).