This commit is contained in:
phiresky 2023-08-02 23:14:32 +00:00
parent e6e96a71e6
commit 0f775341a6

View File

@ -120,8 +120,8 @@ pub async fn get_actor_cached(
/// intern urls to reduce memory usage /// intern urls to reduce memory usage
/// not sure if worth it /// not sure if worth it
pub fn intern_url<'a>(url: impl Into<Cow<'a, Url>>) -> Arc<Url> { pub fn intern_url<'a>(url: impl Into<Cow<'a, Url>>) -> Arc<Url> {
let url: Cow<'a, Url> = url.into();
static INTERNED_URLS: Lazy<DashSet<Arc<Url>>> = Lazy::new(DashSet::new); static INTERNED_URLS: Lazy<DashSet<Arc<Url>>> = Lazy::new(DashSet::new);
let url: Cow<'a, Url> = url.into();
return INTERNED_URLS return INTERNED_URLS
.get::<Url>(url.borrow()) .get::<Url>(url.borrow())
.map(|e| e.clone()) .map(|e| e.clone())