From 4f998497bb1af93ae5c01774289defddcafcc44b Mon Sep 17 00:00:00 2001 From: Ara Sadoyan Date: Mon, 10 Feb 2025 18:48:57 +0100 Subject: [PATCH] Remember this --- src/web/proxyhttp.rs | 10 +++++----- src/web/start.rs | 14 ++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index 0788f8f..2778fb6 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -19,13 +19,13 @@ pub struct LB { pub upstreams: Arc, AtomicUsize)>>>, // pub umap_full: Arc, AtomicUsize)>>>, } -pub struct BGService { - pub upstreams: Arc, AtomicUsize)>>>, - // pub umap_full: Arc, AtomicUsize)>>>, -} +// pub struct BGService { +// pub upstreams: Arc, AtomicUsize)>>>, +// pub umap_full: Arc, AtomicUsize)>>>, +// } #[async_trait] -impl BackgroundService for BGService { +impl BackgroundService for LB { async fn start(&self, mut shutdown: ShutdownWatch) { println!("Starting example background service"); let mut period = interval(Duration::from_secs(10)); diff --git a/src/web/start.rs b/src/web/start.rs index fa35da1..c56fde7 100644 --- a/src/web/start.rs +++ b/src/web/start.rs @@ -1,4 +1,4 @@ -use crate::web::proxyhttp::{BGService, LB}; +use crate::web::proxyhttp::LB; use dashmap::DashMap; use pingora_core::prelude::background_service; use pingora_core::server::Server; @@ -16,17 +16,15 @@ pub fn run() { let config = Arc::new(RwLock::new(upstreams_map)); let lb = LB { - upstreams: config.clone(), - // umap_full: config.clone(), + upstreams: config.clone(), // umap_full: config.clone() }; - let bg_service = BGService { - upstreams: config.clone(), - // umap_full: config.clone(), + let bg = LB { + upstreams: config.clone(), // umap_full: config.clone() }; - let bg_srvc = background_service("bgsrvc", bg_service); - + let bg_srvc = background_service("bgsrvc", bg); let mut proxy = pingora_proxy::http_proxy_service(&server.configuration, lb); + proxy.add_tcp("0.0.0.0:6193"); server.add_service(proxy); server.add_service(bg_srvc);