Clippy lints, dashmap for breakers
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ impl QueryContact {
|
||||
.await?;
|
||||
|
||||
let (username, display_name, url, avatar) =
|
||||
to_contact(contact).ok_or_else(|| ErrorKind::Extract("contact"))?;
|
||||
to_contact(contact).ok_or(ErrorKind::Extract("contact"))?;
|
||||
|
||||
state
|
||||
.node_cache
|
||||
|
||||
@@ -51,18 +51,18 @@ impl QueryInstance {
|
||||
.await?;
|
||||
|
||||
let description = if instance.description.is_empty() {
|
||||
instance.short_description.unwrap_or(String::new())
|
||||
instance.short_description.unwrap_or_default()
|
||||
} else {
|
||||
instance.description
|
||||
};
|
||||
|
||||
if let Some(mut contact) = instance.contact {
|
||||
let uuid = if let Some(uuid) = state.media.get_uuid(contact.avatar.clone()).await? {
|
||||
contact.avatar = state.config.generate_url(UrlKind::Media(uuid)).into();
|
||||
contact.avatar = state.config.generate_url(UrlKind::Media(uuid));
|
||||
uuid
|
||||
} else {
|
||||
let uuid = state.media.store_url(contact.avatar.clone()).await?;
|
||||
contact.avatar = state.config.generate_url(UrlKind::Media(uuid)).into();
|
||||
contact.avatar = state.config.generate_url(UrlKind::Media(uuid));
|
||||
uuid
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ pub(crate) use self::{
|
||||
use crate::{
|
||||
config::Config,
|
||||
data::{ActorCache, MediaCache, NodeCache, State},
|
||||
db::Db,
|
||||
error::{Error, ErrorKind},
|
||||
jobs::process_listeners::Listeners,
|
||||
requests::Requests,
|
||||
@@ -24,7 +23,6 @@ use background_jobs::{memory_storage::Storage, Job, QueueHandle, WorkerConfig};
|
||||
use std::time::Duration;
|
||||
|
||||
pub(crate) fn create_workers(
|
||||
db: Db,
|
||||
state: State,
|
||||
actors: ActorCache,
|
||||
media: MediaCache,
|
||||
@@ -32,7 +30,6 @@ pub(crate) fn create_workers(
|
||||
) -> JobServer {
|
||||
let queue_handle = WorkerConfig::new(Storage::new(), move |queue_handle| {
|
||||
JobState::new(
|
||||
db.clone(),
|
||||
state.clone(),
|
||||
actors.clone(),
|
||||
JobServer::new(queue_handle),
|
||||
@@ -62,7 +59,6 @@ pub(crate) fn create_workers(
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct JobState {
|
||||
db: Db,
|
||||
requests: Requests,
|
||||
state: State,
|
||||
actors: ActorCache,
|
||||
@@ -87,7 +83,6 @@ impl std::fmt::Debug for JobServer {
|
||||
|
||||
impl JobState {
|
||||
fn new(
|
||||
db: Db,
|
||||
state: State,
|
||||
actors: ActorCache,
|
||||
job_server: JobServer,
|
||||
@@ -97,7 +92,6 @@ impl JobState {
|
||||
JobState {
|
||||
requests: state.requests(&config),
|
||||
node_cache: state.node_cache(),
|
||||
db,
|
||||
actors,
|
||||
config,
|
||||
media,
|
||||
|
||||
@@ -66,7 +66,8 @@ impl QueryNodeinfo {
|
||||
if let Some(contact_id) = accounts.get(0) {
|
||||
state
|
||||
.job_server
|
||||
.queue(QueryContact::new(self.actor_id, contact_id.clone())).await?;
|
||||
.queue(QueryContact::new(self.actor_id, contact_id.clone()))
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,10 +130,7 @@ enum MaybeSupported<T> {
|
||||
|
||||
impl<T> MaybeSupported<T> {
|
||||
fn is_supported(&self) -> bool {
|
||||
match self {
|
||||
MaybeSupported::Supported(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, MaybeSupported::Supported(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user