Skip to content

Commit

Permalink
chore: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePieWw committed Jan 13, 2025
1 parent 06581ed commit 0e0ec53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/meta-srv/src/election/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ mod tests {
use tokio_postgres::{Client, NoTls};

use super::*;
use crate::{election::CANDIDATE_KEEP_ALIVE_INTERVAL_SECS, error::PostgresExecutionSnafu};
use crate::election::CANDIDATE_KEEP_ALIVE_INTERVAL_SECS;
use crate::error::PostgresExecutionSnafu;

async fn create_postgres_client(table_name: Option<&str>) -> Result<Client> {
let endpoint = env::var("GT_POSTGRES_ENDPOINTS").unwrap_or_default();
Expand Down
27 changes: 12 additions & 15 deletions src/meta-srv/src/metasrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,23 +494,20 @@ impl Metasrv {
let node_info = self.node_info();
let _handle = common_runtime::spawn_global(async move {
while started.load(Ordering::Relaxed) {
loop {
let res = election.register_candidate(&node_info).await;
if let Err(e) = res {
warn!(e; "Metasrv register candidate error");
continue;
}
if let Err(e) = election.register_candidate(&node_info).await {
warn!(e; "Metasrv register candidate error");
} else {
break;
}
loop {
let mut keep_alive_interval = tokio::time::interval(
Duration::from_secs(CANDIDATE_KEEP_ALIVE_INTERVAL_SECS),
);
keep_alive_interval.tick().await;
let res = election.candidate_keep_alive(&node_info).await;
if let Err(e) = res {
warn!(e; "Metasrv keep lease error");
}
}
while started.load(Ordering::Relaxed) {
let mut keep_alive_interval = tokio::time::interval(Duration::from_secs(
CANDIDATE_KEEP_ALIVE_INTERVAL_SECS,
));
keep_alive_interval.tick().await;
let res = election.candidate_keep_alive(&node_info).await;
if let Err(e) = res {
warn!(e; "Metasrv keep lease error");
}
}
});
Expand Down

0 comments on commit 0e0ec53

Please sign in to comment.