From: Luna <46259660+LunaticHacker@users.noreply.github.com> Date: Mon, 11 Jul 2022 17:12:12 +0000 (+0530) Subject: remove parking_lot (#2350) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/readmes/%24%7Bargs.pageFn.jump%20n%7D?a=commitdiff_plain;h=e33736ae47be5fd4dc7006d15297bb6fc1de4722;p=lemmy.git remove parking_lot (#2350) --- diff --git a/Cargo.lock b/Cargo.lock index 800aa024..d6cbfbdd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1961,7 +1961,6 @@ dependencies = [ "lemmy_utils", "lemmy_websocket", "once_cell", - "parking_lot 0.12.0", "reqwest", "reqwest-middleware", "serde", @@ -2076,7 +2075,6 @@ dependencies = [ "lemmy_websocket", "opentelemetry 0.17.0", "opentelemetry-otlp", - "parking_lot 0.12.0", "reqwest", "reqwest-middleware", "reqwest-retry", diff --git a/Cargo.toml b/Cargo.toml index c3d52425..407a19ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,6 @@ reqwest-middleware = "0.1.5" reqwest-tracing = "0.2.1" clokwerk = "0.3.5" doku = "0.11.0" -parking_lot = "0.12.0" reqwest-retry = "0.1.5" console-subscriber = { version = "0.1.3", optional = true } opentelemetry = { version = "0.17.0", features = ["rt-tokio"], optional = true } diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index 7e8e9528..2714eb8b 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -44,7 +44,6 @@ anyhow = "1.0.56" reqwest = { version = "0.11.10", features = ["json"] } html2md = "0.2.13" once_cell = "1.10.0" -parking_lot = "0.12.0" [dev-dependencies] serial_test = "0.6.0" diff --git a/crates/apub/src/objects/mod.rs b/crates/apub/src/objects/mod.rs index 7293fc36..8f11f03b 100644 --- a/crates/apub/src/objects/mod.rs +++ b/crates/apub/src/objects/mod.rs @@ -71,10 +71,9 @@ pub(crate) mod tests { settings::SETTINGS, }; use lemmy_websocket::{chat_server::ChatServer, LemmyContext}; - use parking_lot::Mutex; use reqwest::{Client, Request, Response}; use reqwest_middleware::{ClientBuilder, Middleware, Next}; - use std::sync::Arc; + use std::sync::{Arc, Mutex}; use task_local_extensions::Extensions; struct BlockedMiddleware; diff --git a/crates/utils/src/rate_limit/mod.rs b/crates/utils/src/rate_limit/mod.rs index f8acc3af..79bdbb1d 100644 --- a/crates/utils/src/rate_limit/mod.rs +++ b/crates/utils/src/rate_limit/mod.rs @@ -4,13 +4,12 @@ use actix_web::{ HttpResponse, }; use futures::future::{ok, Ready}; -use parking_lot::Mutex; use rate_limiter::{RateLimitType, RateLimiter}; use std::{ future::Future, pin::Pin, rc::Rc, - sync::Arc, + sync::{Arc, Mutex}, task::{Context, Poll}, }; @@ -85,7 +84,7 @@ impl RateLimited { RateLimitType::Comment => (rate_limit.comment, rate_limit.comment_per_second), RateLimitType::Search => (rate_limit.search, rate_limit.search_per_second), }; - let mut limiter = self.rate_limiter.lock(); + let mut limiter = self.rate_limiter.lock().expect("mutex poison error"); limiter.check_rate_limit_full(self.type_, &ip_addr, kind, interval) } diff --git a/src/main.rs b/src/main.rs index 3fc3bbc4..fa771c3d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,12 +29,16 @@ use lemmy_utils::{ settings::{structs::Settings, SETTINGS}, }; use lemmy_websocket::{chat_server::ChatServer, LemmyContext}; -use parking_lot::Mutex; use reqwest::Client; use reqwest_middleware::ClientBuilder; use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware}; use reqwest_tracing::TracingMiddleware; -use std::{env, sync::Arc, thread, time::Duration}; +use std::{ + env, + sync::{Arc, Mutex}, + thread, + time::Duration, +}; use tracing_actix_web::TracingLogger; embed_migrations!();