Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
➖ Arc was pretty useless
Browse files Browse the repository at this point in the history
  • Loading branch information
kbudde committed Jul 30, 2023
1 parent f8c53c9 commit bb1930c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::io::stdout;
use std::sync::Arc;

use std::time::{Duration, SystemTime};
use structured_logger::{json::new_writer, Builder};

Expand Down Expand Up @@ -56,14 +56,13 @@ async fn main() -> Result<(), Box<dyn Error>> {

let addr = ([0, 0, 0, 0], 9898).into();

let client = Arc::new(PrometheusClient::from_config(&config)?);
let client = PrometheusClient::from_config(&config)?;

let metrics = make_service_fn(move |_| {
let client = client.clone();
async move {
Ok::<_, hyper::Error>(service_fn(move |req| {
let client = client.clone();
handler(req, client)
handler(req, client.to_owned())
}))
}
});
Expand Down Expand Up @@ -208,7 +207,7 @@ impl PrometheusClient {

async fn handler(
_req: Request<Body>,
pc: Arc<PrometheusClient>,
pc: PrometheusClient,
) -> Result<Response<Body>, hyper::Error> {
let encoder = TextEncoder::new();

Expand Down

0 comments on commit bb1930c

Please sign in to comment.