mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-29 22:38:36 +08:00
Remember this
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user