From 16a16c2de244dd7b423f299fe96230ff8c3453dc Mon Sep 17 00:00:00 2001 From: Chongzhi Deng <57183262+BruceAko@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:04:24 +0800 Subject: [PATCH] feat: add interval field to AnnounceHostRequest (#562) Signed-off-by: BruceAko --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- dragonfly-client/src/announcer/mod.rs | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 559511a3..5a82de8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -950,9 +950,9 @@ dependencies = [ [[package]] name = "dragonfly-api" -version = "2.0.124" +version = "2.0.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab958fa6959f459c170f87cccae5adae0010fc3be09b9f98a433b898a7f4158" +checksum = "207061abbe99efaa0d5346e6c0e301a4039e2e855853bc59dbe062596edc1a20" dependencies = [ "prost 0.11.9", "prost-types 0.12.6", diff --git a/Cargo.toml b/Cargo.toml index 4461a844..bd4232f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.8 dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.82" } dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.82" } thiserror = "1.0" -dragonfly-api = "2.0.124" +dragonfly-api = "2.0.126" reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] } rcgen = { version = "0.12.1", features = ["x509-parser"] } hyper = { version = "1.2", features = ["full"] } diff --git a/dragonfly-client/src/announcer/mod.rs b/dragonfly-client/src/announcer/mod.rs index 26a0aadc..145ba5eb 100644 --- a/dragonfly-client/src/announcer/mod.rs +++ b/dragonfly-client/src/announcer/mod.rs @@ -23,6 +23,7 @@ use dragonfly_client_config::{ dfdaemon::{Config, HostType}, CARGO_PKG_RUSTC_VERSION, CARGO_PKG_VERSION, GIT_HASH, }; +use dragonfly_client_core::error::{ErrorType, OrErr}; use dragonfly_client_core::Result; use std::env; use std::sync::Arc; @@ -272,6 +273,12 @@ impl SchedulerAnnouncer { scheduler_cluster_id: 0, }; - Ok(AnnounceHostRequest { host: Some(host) }) + Ok(AnnounceHostRequest { + host: Some(host), + interval: Some( + prost_wkt_types::Duration::try_from(self.config.scheduler.announce_interval) + .or_err(ErrorType::ParseError)?, + ), + }) } }