From e7d96ecc6e9c87254479ed94a013755e65f330c0 Mon Sep 17 00:00:00 2001 From: Muskan Paliwal Date: Thu, 26 Oct 2023 15:56:41 +0530 Subject: [PATCH] changes back to main branch --- vibi-dpu/src/bitbucket/comment.rs | 3 +-- vibi-dpu/src/bitbucket/config.rs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vibi-dpu/src/bitbucket/comment.rs b/vibi-dpu/src/bitbucket/comment.rs index 1227e70e..8ee80e8d 100644 --- a/vibi-dpu/src/bitbucket/comment.rs +++ b/vibi-dpu/src/bitbucket/comment.rs @@ -9,8 +9,7 @@ use crate::db::user::get_workspace_user_from_db; use crate::utils::review::Review; use crate::utils::user::BitbucketUser; -use super::{config::{bitbucket_base_url, prepare_headers}}; -use crate::client::config::get_client; +use super::{config::{bitbucket_base_url, get_client, prepare_headers}}; #[derive(Serialize)] struct Comment { diff --git a/vibi-dpu/src/bitbucket/config.rs b/vibi-dpu/src/bitbucket/config.rs index 8a5f9a98..dc678d37 100644 --- a/vibi-dpu/src/bitbucket/config.rs +++ b/vibi-dpu/src/bitbucket/config.rs @@ -1,7 +1,19 @@ use std::{env, collections::HashMap}; +use std::error::Error; + use reqwest::{Response, header::{HeaderMap, HeaderValue}}; use serde_json::Value; -use crate::client::config::get_client; +use std::sync::Arc; +use once_cell::sync::Lazy; +use reqwest::Client; + +static CLIENT: Lazy> = Lazy::new(|| { + Arc::new(Client::new()) +}); + +pub fn get_client() -> Arc { + Arc::clone(&CLIENT) +} pub fn bitbucket_base_url() -> String { env::var("BITBUCKET_BASE_URL").expect("BITBUCKET_BASE_URL must be set")