refactor(sgl-router): Replace once_cell with LazyLock in worker.rs and remove once_cell dependency from Cargo.toml (#8698)

This commit is contained in:
Tien Nguyen
2025-08-07 20:14:03 +07:00
committed by GitHub
parent 482c3db29f
commit fd05b56750
2 changed files with 2 additions and 4 deletions

View File

@@ -25,7 +25,6 @@ dashmap = "6.1.0"
http = "1.1.0"
tokio = { version = "1.42.0", features = ["full"] }
async-trait = "0.1"
once_cell = "1.21"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "chrono"] }
tracing-log = "0.2"

View File

@@ -1,14 +1,13 @@
use super::{WorkerError, WorkerResult};
use async_trait::async_trait;
use futures;
use once_cell::sync::Lazy;
use serde_json;
use std::fmt;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
// Shared HTTP client for worker operations (health checks, server info, etc.)
static WORKER_CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
static WORKER_CLIENT: LazyLock<reqwest::Client> = LazyLock::new(|| {
reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(30)) // Default timeout, overridden per request
.build()