From a8715714220bea7f71701830e957dc3bacb31002 Mon Sep 17 00:00:00 2001 From: Nick Gerace Date: Thu, 13 Mar 2025 11:41:40 -0400 Subject: [PATCH] Use verideath investigation nats fork Signed-off-by: Nick Gerace --- Cargo.lock | 3 +-- Cargo.toml | 2 +- lib/veritech-server/src/heartbeat.rs | 19 ++++++------------- third-party/rust/BUCK | 21 ++++++++++----------- third-party/rust/Cargo.lock | 3 +-- third-party/rust/Cargo.toml | 2 +- 6 files changed, 20 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0e7f9d6db2..3a303e702e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,8 +255,7 @@ dependencies = [ [[package]] name = "async-nats" version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a798aab0c0203b31d67d501e5ed1f3ac6c36a329899ce47fc93c3bea53f3ae89" +source = "git+https://github.com/systeminit/nats.rs.git?branch=nick/d94750e#f9468de5062d60d5bb4c77f51da164323688d6ff" dependencies = [ "base64 0.22.1", "bytes", diff --git a/Cargo.toml b/Cargo.toml index cd9e6896c1..d994e0a358 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,7 +94,7 @@ rust-version = "1.82" publish = false [workspace.dependencies] -async-nats = { version = "0.39.0", features = ["service"] } +async-nats = { git = "https://github.com/systeminit/nats.rs.git", branch = "nick/d94750e", features = ["service"] } async-openai = "0.26.0" async-recursion = "1.1.1" async-trait = "0.1.83" diff --git a/lib/veritech-server/src/heartbeat.rs b/lib/veritech-server/src/heartbeat.rs index b60c74d39e..08b02d36cc 100644 --- a/lib/veritech-server/src/heartbeat.rs +++ b/lib/veritech-server/src/heartbeat.rs @@ -112,15 +112,11 @@ impl HeartbeatApp { Err(err) => { error!(si.error.message = ?err, "heartbeat: publish error"); metric!(counter.veritech.heartbeat.publish.error = 1); + self.needs_force_reconnect = true; } }, - // NOTE(nick): this is going to be an "Elapsed" error, which contains a single private - // field: the unit type. As a result of this, we cannot match on the specific error. I - // don't love the underscore here in case the underlying API changes, but here we are. Err(_) => { metric!(counter.veritech.heartbeat.publish.timeout = 1); - - // How do we know we need to reconnect? We are unable to publish in a reasonable timeframe. self.needs_force_reconnect = true; } } @@ -164,10 +160,6 @@ impl HeartbeatApp { } async fn perform_force_reconnect(&mut self) { - // NOTE(nick): consider not blocking heartbeats when performing force reconnection. - // This is tricky because you don't want to pile on the pain if you need to force a - // reconnection, but we also may not want to block heartbeats. We could go either way - // on this one, but the current stance should be sufficient. match tokio::time::timeout( self.force_reconnect_timeout_duration, self.nats.force_reconnect(), @@ -182,12 +174,13 @@ impl HeartbeatApp { Err(err) => { error!(si.error.message = ?err, "heartbeat: force reconnect error"); metric!(counter.veritech.heartbeat.force_reconnect.error = 1); + self.needs_force_reconnect = true; } }, - // NOTE(nick): this is going to be an "Elapsed" error, which contains a single private - // field: the unit type. As a result of this, we cannot match on the specific error. I - // don't love the underscore here in case the underlying API changes, but here we are. - Err(_) => metric!(counter.veritech.heartbeat.force_reconnect.timeout = 1), + Err(_) => { + metric!(counter.veritech.heartbeat.force_reconnect.timeout = 1); + self.needs_force_reconnect = true; + } } } } diff --git a/third-party/rust/BUCK b/third-party/rust/BUCK index 9d786a588f..aa36c4fd29 100644 --- a/third-party/rust/BUCK +++ b/third-party/rust/BUCK @@ -17,6 +17,13 @@ git_fetch( visibility = [], ) +git_fetch( + name = "nats.rs-639306d6e61a4ca7.git", + repo = "https://github.com/systeminit/nats.rs.git", + rev = "f9468de5062d60d5bb4c77f51da164323688d6ff", + visibility = [], +) + git_fetch( name = "rust-s3-61c54947c717d042.git", repo = "https://github.com/ScuffleTV/rust-s3.git", @@ -606,22 +613,14 @@ alias( visibility = ["PUBLIC"], ) -http_archive( - name = "async-nats-0.39.0.crate", - sha256 = "a798aab0c0203b31d67d501e5ed1f3ac6c36a329899ce47fc93c3bea53f3ae89", - strip_prefix = "async-nats-0.39.0", - urls = ["https://static.crates.io/crates/async-nats/0.39.0/download"], - visibility = [], -) - cargo.rust_library( name = "async-nats-0.39.0", - srcs = [":async-nats-0.39.0.crate"], + srcs = [":nats.rs-639306d6e61a4ca7.git"], crate = "async_nats", - crate_root = "async-nats-0.39.0.crate/src/lib.rs", + crate_root = "nats.rs-639306d6e61a4ca7/async-nats/src/lib.rs", edition = "2021", env = { - "CARGO_MANIFEST_DIR": "async-nats-0.39.0.crate", + "CARGO_MANIFEST_DIR": "nats.rs-639306d6e61a4ca7", "CARGO_PKG_AUTHORS": "Tomasz Pietrek :Casper Beyer ", "CARGO_PKG_DESCRIPTION": "A async Rust NATS client", "CARGO_PKG_NAME": "async-nats", diff --git a/third-party/rust/Cargo.lock b/third-party/rust/Cargo.lock index 4b887688da..7ca8fae68f 100644 --- a/third-party/rust/Cargo.lock +++ b/third-party/rust/Cargo.lock @@ -219,8 +219,7 @@ dependencies = [ [[package]] name = "async-nats" version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a798aab0c0203b31d67d501e5ed1f3ac6c36a329899ce47fc93c3bea53f3ae89" +source = "git+https://github.com/systeminit/nats.rs.git?branch=nick%2Fd94750e#f9468de5062d60d5bb4c77f51da164323688d6ff" dependencies = [ "base64 0.22.1", "bytes", diff --git a/third-party/rust/Cargo.toml b/third-party/rust/Cargo.toml index 6001f64581..3880438fa2 100644 --- a/third-party/rust/Cargo.toml +++ b/third-party/rust/Cargo.toml @@ -28,7 +28,7 @@ rust-version = "1.82" publish = false [dependencies] -async-nats = { version = "0.39.0", features = ["service"] } +async-nats = { git = "https://github.com/systeminit/nats.rs.git", branch = "nick/d94750e", features = ["service"] } async-openai = "0.26.0" async-recursion = "1.1.1" async-trait = "0.1.83"