remove parking_lot (#2350)

This commit is contained in:
Luna 2022-07-11 22:42:12 +05:30 committed by GitHub
parent 67a34adf4b
commit e33736ae47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 11 deletions

2
Cargo.lock generated
View file

@ -1961,7 +1961,6 @@ dependencies = [
"lemmy_utils", "lemmy_utils",
"lemmy_websocket", "lemmy_websocket",
"once_cell", "once_cell",
"parking_lot 0.12.0",
"reqwest", "reqwest",
"reqwest-middleware", "reqwest-middleware",
"serde", "serde",
@ -2076,7 +2075,6 @@ dependencies = [
"lemmy_websocket", "lemmy_websocket",
"opentelemetry 0.17.0", "opentelemetry 0.17.0",
"opentelemetry-otlp", "opentelemetry-otlp",
"parking_lot 0.12.0",
"reqwest", "reqwest",
"reqwest-middleware", "reqwest-middleware",
"reqwest-retry", "reqwest-retry",

View file

@ -60,7 +60,6 @@ reqwest-middleware = "0.1.5"
reqwest-tracing = "0.2.1" reqwest-tracing = "0.2.1"
clokwerk = "0.3.5" clokwerk = "0.3.5"
doku = "0.11.0" doku = "0.11.0"
parking_lot = "0.12.0"
reqwest-retry = "0.1.5" reqwest-retry = "0.1.5"
console-subscriber = { version = "0.1.3", optional = true } console-subscriber = { version = "0.1.3", optional = true }
opentelemetry = { version = "0.17.0", features = ["rt-tokio"], optional = true } opentelemetry = { version = "0.17.0", features = ["rt-tokio"], optional = true }

View file

@ -44,7 +44,6 @@ anyhow = "1.0.56"
reqwest = { version = "0.11.10", features = ["json"] } reqwest = { version = "0.11.10", features = ["json"] }
html2md = "0.2.13" html2md = "0.2.13"
once_cell = "1.10.0" once_cell = "1.10.0"
parking_lot = "0.12.0"
[dev-dependencies] [dev-dependencies]
serial_test = "0.6.0" serial_test = "0.6.0"

View file

@ -71,10 +71,9 @@ pub(crate) mod tests {
settings::SETTINGS, settings::SETTINGS,
}; };
use lemmy_websocket::{chat_server::ChatServer, LemmyContext}; use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use parking_lot::Mutex;
use reqwest::{Client, Request, Response}; use reqwest::{Client, Request, Response};
use reqwest_middleware::{ClientBuilder, Middleware, Next}; use reqwest_middleware::{ClientBuilder, Middleware, Next};
use std::sync::Arc; use std::sync::{Arc, Mutex};
use task_local_extensions::Extensions; use task_local_extensions::Extensions;
struct BlockedMiddleware; struct BlockedMiddleware;

View file

@ -4,13 +4,12 @@ use actix_web::{
HttpResponse, HttpResponse,
}; };
use futures::future::{ok, Ready}; use futures::future::{ok, Ready};
use parking_lot::Mutex;
use rate_limiter::{RateLimitType, RateLimiter}; use rate_limiter::{RateLimitType, RateLimiter};
use std::{ use std::{
future::Future, future::Future,
pin::Pin, pin::Pin,
rc::Rc, rc::Rc,
sync::Arc, sync::{Arc, Mutex},
task::{Context, Poll}, task::{Context, Poll},
}; };
@ -85,7 +84,7 @@ impl RateLimited {
RateLimitType::Comment => (rate_limit.comment, rate_limit.comment_per_second), RateLimitType::Comment => (rate_limit.comment, rate_limit.comment_per_second),
RateLimitType::Search => (rate_limit.search, rate_limit.search_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) limiter.check_rate_limit_full(self.type_, &ip_addr, kind, interval)
} }

View file

@ -29,12 +29,16 @@ use lemmy_utils::{
settings::{structs::Settings, SETTINGS}, settings::{structs::Settings, SETTINGS},
}; };
use lemmy_websocket::{chat_server::ChatServer, LemmyContext}; use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use parking_lot::Mutex;
use reqwest::Client; use reqwest::Client;
use reqwest_middleware::ClientBuilder; use reqwest_middleware::ClientBuilder;
use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware}; use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware};
use reqwest_tracing::TracingMiddleware; 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; use tracing_actix_web::TracingLogger;
embed_migrations!(); embed_migrations!();