-use crate::websocket::chat_server::ChatServer;
-use actix::Addr;
-use lemmy_db_schema::{source::secret::Secret, utils::DbPool};
+use lemmy_db_schema::{
+ source::secret::Secret,
+ utils::{ActualDbPool, DbPool},
+};
use lemmy_utils::{
rate_limit::RateLimitCell,
settings::{structs::Settings, SETTINGS},
#[derive(Clone)]
pub struct LemmyContext {
- pool: DbPool,
- chat_server: Addr<ChatServer>,
+ pool: ActualDbPool,
client: Arc<ClientWithMiddleware>,
secret: Arc<Secret>,
rate_limit_cell: RateLimitCell,
impl LemmyContext {
pub fn create(
- pool: DbPool,
- chat_server: Addr<ChatServer>,
+ pool: ActualDbPool,
client: ClientWithMiddleware,
secret: Secret,
rate_limit_cell: RateLimitCell,
) -> LemmyContext {
LemmyContext {
pool,
- chat_server,
client: Arc::new(client),
secret: Arc::new(secret),
rate_limit_cell,
}
}
- pub fn pool(&self) -> &DbPool {
- &self.pool
+ pub fn pool(&self) -> DbPool<'_> {
+ DbPool::Pool(&self.pool)
}
- pub fn chat_server(&self) -> &Addr<ChatServer> {
- &self.chat_server
+ pub fn inner_pool(&self) -> &ActualDbPool {
+ &self.pool
}
pub fn client(&self) -> &ClientWithMiddleware {
&self.client