Remember this

This commit is contained in:
Ara Sadoyan
2025-02-10 18:48:57 +01:00
parent e4fb2ad74f
commit 4f998497bb
2 changed files with 11 additions and 13 deletions

View File

@@ -19,13 +19,13 @@ pub struct LB {
pub upstreams: Arc<RwLock<DashMap<String, (Vec<(String, u16)>, AtomicUsize)>>>,
// pub umap_full: Arc<RwLock<DashMap<String, (Vec<(String, u16)>, AtomicUsize)>>>,
}
pub struct BGService {
pub upstreams: Arc<RwLock<DashMap<String, (Vec<(String, u16)>, AtomicUsize)>>>,
// pub umap_full: Arc<RwLock<DashMap<String, (Vec<(String, u16)>, AtomicUsize)>>>,
}
// pub struct BGService {
// pub upstreams: Arc<RwLock<DashMap<String, (Vec<(String, u16)>, AtomicUsize)>>>,
// pub umap_full: Arc<RwLock<DashMap<String, (Vec<(String, u16)>, 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));

View File

@@ -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);