From 976113a4a04b3ba10a797d8d3c442920933a26a4 Mon Sep 17 00:00:00 2001 From: Kushagra Udai Date: Fri, 22 Nov 2024 18:26:36 -0800 Subject: [PATCH] Make client sync again --- CHANGELOG.md | 6 +++++- Cargo.toml | 2 +- src/lib.rs | 8 ++++---- src/metrics.rs | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5359871..7141b3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Unreleased -## 0.8.0 - 2024-11-20 +## 0.8.1 - 2024-11-20 ### Changed - `opentelemetry` upgraded to version `0.27` from `0.24`. - Removed `prometheus` dependency in the `metrics` feature, replacing it with a `metrics_receiver` in a metrics library agnostic fashion. +## 0.8.0 - 2024-11-20 + +- YANKED because `Consul` was no longer `Sync`. + ## 0.7.0 - 2024-06-25 ### Changed diff --git a/Cargo.toml b/Cargo.toml index a2c1af7..3a7ca18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-consul" -version = "0.8.0" +version = "0.8.1" authors = ["Roblox"] edition = "2021" description = "This crate provides access to a set of strongly typed apis to interact with consul (https://www.consul.io/)" diff --git a/src/lib.rs b/src/lib.rs index 7ab53cd..ba649ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -228,9 +228,9 @@ pub struct Consul { #[cfg(feature = "trace")] tracer: BoxedTracer, #[cfg(feature = "metrics")] - metrics_tx: std::sync::mpsc::Sender, + metrics_tx: tokio::sync::mpsc::UnboundedSender, #[cfg(feature = "metrics")] - metrics_rx: Option>, + metrics_rx: Option>, } fn https_connector() -> hyper_rustls::HttpsConnector { @@ -294,7 +294,7 @@ impl Consul { /// - [HttpsClient](consul::HttpsClient) pub fn new_with_client(config: Config, https_client: HttpsClient) -> Self { #[cfg(feature = "metrics")] - let (tx, rx) = std::sync::mpsc::channel::(); + let (tx, rx) = tokio::sync::mpsc::unbounded_channel::(); Consul { https_client, config, @@ -309,7 +309,7 @@ impl Consul { #[cfg(feature = "metrics")] /// Returns the metrics receiver for the consul client. - pub fn metrics_receiver(&mut self) -> Option> { + pub fn metrics_receiver(&mut self) -> Option> { self.metrics_rx.take() } diff --git a/src/metrics.rs b/src/metrics.rs index fa599d7..abfa60f 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -43,7 +43,7 @@ impl MetricInfo { #[derive(Debug, Clone)] pub(crate) struct MetricInfoWrapper { metrics: MetricInfo, - sender: Option>, + sender: Option>, start: std::time::Instant, } @@ -53,7 +53,7 @@ impl MetricInfoWrapper { method: HttpMethod, function: Function, status: Option, - sender: std::sync::mpsc::Sender, + sender: tokio::sync::mpsc::UnboundedSender, ) -> Self { Self { metrics: MetricInfo::new(method, function, status),