-
Notifications
You must be signed in to change notification settings - Fork 0
retry sending definitions #201
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 |
|---|---|---|
|
|
@@ -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}; | ||
|
|
@@ -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 { | ||
| 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
|
||
| } | ||
|
|
||
| let health_task = if config.with_health_service { | ||
|
|
||
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.
while !success { ... if success { break; } }is redundant and makes the loop harder to read. Consider using aloop {}with a singlebreakwhen the send succeeds (or returning early), which also avoids trackingsuccessseparately.