cargo fmt
This commit is contained in:
@@ -16,8 +16,8 @@ use crate::daemon::models::Attachment;
|
||||
use crate::daemon::Daemon;
|
||||
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::mpsc::{Receiver, Sender};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use tokio::pin;
|
||||
|
||||
@@ -32,7 +32,7 @@ pub enum AttachmentStoreEvent {
|
||||
GetAttachmentInfo(String, Reply<Attachment>),
|
||||
|
||||
// Queue a download for a given attachment guid.
|
||||
// Args:
|
||||
// Args:
|
||||
// - attachment guid
|
||||
// - preview: whether to download the preview (true) or full attachment (false)
|
||||
QueueDownloadAttachment(String, bool),
|
||||
@@ -62,7 +62,10 @@ impl AttachmentStore {
|
||||
data_dir.join("attachments")
|
||||
}
|
||||
|
||||
pub fn new(database: Arc<Mutex<Database>>, daemon_event_sink: Sender<Event>) -> AttachmentStore {
|
||||
pub fn new(
|
||||
database: Arc<Mutex<Database>>,
|
||||
daemon_event_sink: Sender<Event>,
|
||||
) -> AttachmentStore {
|
||||
let store_path = Self::get_default_store_path();
|
||||
log::info!(target: target::ATTACHMENTS, "Attachment store path: {}", store_path.display());
|
||||
|
||||
@@ -97,7 +100,7 @@ impl AttachmentStore {
|
||||
metadata: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async fn download_attachment(&mut self, attachment: &Attachment, preview: bool) -> Result<()> {
|
||||
if attachment.is_downloaded(preview) {
|
||||
log::info!(target: target::ATTACHMENTS, "Attachment already downloaded: {}", attachment.guid);
|
||||
@@ -130,7 +133,7 @@ impl AttachmentStore {
|
||||
log::info!(target: target::ATTACHMENTS, "Completed download for attachment: {}", attachment.guid);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
pub async fn run(&mut self) {
|
||||
loop {
|
||||
tokio::select! {
|
||||
|
||||
Reference in New Issue
Block a user