Private
Public Access
1
0

AttachmentStore: less chatty logging

This commit is contained in:
2025-06-27 00:52:09 -07:00
parent 6e14585a12
commit 21703b9f8e
3 changed files with 9 additions and 9 deletions

View File

@@ -120,17 +120,17 @@ impl AttachmentStore {
let attachment = Self::get_attachment_impl(store_path, guid); let attachment = Self::get_attachment_impl(store_path, guid);
if attachment.is_downloaded(preview) { if attachment.is_downloaded(preview) {
log::info!(target: target::ATTACHMENTS, "Attachment already downloaded: {}", attachment.guid); log::debug!(target: target::ATTACHMENTS, "Attachment already downloaded: {}", attachment.guid);
return Err(AttachmentStoreError::AttachmentAlreadyDownloaded.into()); return Err(AttachmentStoreError::AttachmentAlreadyDownloaded.into());
} }
let temporary_path = attachment.get_path_for_preview_scratch(preview, true); let temporary_path = attachment.get_path_for_preview_scratch(preview, true);
if std::fs::exists(&temporary_path).unwrap_or(false) { if std::fs::exists(&temporary_path).unwrap_or(false) {
log::info!(target: target::ATTACHMENTS, "Temporary file already exists: {}, assuming download is in progress", temporary_path.display()); log::warn!(target: target::ATTACHMENTS, "Temporary file already exists: {}, assuming download is in progress", temporary_path.display());
return Err(AttachmentStoreError::DownloadAlreadyInProgress.into()); return Err(AttachmentStoreError::DownloadAlreadyInProgress.into());
} }
log::info!(target: target::ATTACHMENTS, "Starting download for attachment: {}", attachment.guid); log::debug!(target: target::ATTACHMENTS, "Starting download for attachment: {}", attachment.guid);
let file = std::fs::File::create(&temporary_path)?; let file = std::fs::File::create(&temporary_path)?;
let mut writer = BufWriter::new(&file); let mut writer = BufWriter::new(&file);
@@ -155,7 +155,7 @@ impl AttachmentStore {
&attachment.get_path_for_preview_scratch(preview, false), &attachment.get_path_for_preview_scratch(preview, false),
)?; )?;
log::info!(target: target::ATTACHMENTS, "Completed download for attachment: {}", attachment.guid); log::debug!(target: target::ATTACHMENTS, "Completed download for attachment: {}", attachment.guid);
// Send a signal to the daemon that the attachment has been downloaded. // Send a signal to the daemon that the attachment has been downloaded.
let event = DaemonEvent::AttachmentDownloaded(attachment.guid.clone()); let event = DaemonEvent::AttachmentDownloaded(attachment.guid.clone());
@@ -240,7 +240,7 @@ impl AttachmentStore {
log::debug!(target: target::ATTACHMENTS, "Queued download for attachment: {}", &guid); log::debug!(target: target::ATTACHMENTS, "Queued download for attachment: {}", &guid);
} else { } else {
log::info!(target: target::ATTACHMENTS, "Attachment already downloaded: {}", guid); log::debug!(target: target::ATTACHMENTS, "Attachment already downloaded: {}", guid);
} }
} }

View File

@@ -374,7 +374,7 @@ impl Daemon {
} }
Event::DownloadAttachment(attachment_id, preview, reply) => { Event::DownloadAttachment(attachment_id, preview, reply) => {
log::info!(target: target::ATTACHMENTS, "Download requested for attachment: {}, preview: {}", &attachment_id, preview); log::debug!(target: target::ATTACHMENTS, "Download requested for attachment: {}, preview: {}", &attachment_id, preview);
self.attachment_store_sink self.attachment_store_sink
.as_ref() .as_ref()
@@ -390,7 +390,7 @@ impl Daemon {
} }
Event::AttachmentDownloaded(attachment_id) => { Event::AttachmentDownloaded(attachment_id) => {
log::info!(target: target::ATTACHMENTS, "Daemon: attachment downloaded: {}, sending signal", attachment_id); log::debug!(target: target::ATTACHMENTS, "Daemon: attachment downloaded: {}, sending signal", attachment_id);
// Send signal to the client that the attachment has been downloaded. // Send signal to the client that the attachment has been downloaded.
self.signal_sender self.signal_sender

View File

@@ -78,7 +78,7 @@ impl UpdateMonitor {
// imagent will post a conversation changed notification when we call getMessages. // imagent will post a conversation changed notification when we call getMessages.
if let Some(last_sync) = self.last_sync_times.get(&conversation.guid) { if let Some(last_sync) = self.last_sync_times.get(&conversation.guid) {
if last_sync.elapsed() < Duration::from_secs(1) { if last_sync.elapsed() < Duration::from_secs(1) {
log::info!(target: target::UPDATES, "Skipping sync for conversation id: {}. Last sync was {} seconds ago.", log::warn!(target: target::UPDATES, "Skipping sync for conversation id: {}. Last sync was {} seconds ago.",
conversation.guid, last_sync.elapsed().as_secs_f64()); conversation.guid, last_sync.elapsed().as_secs_f64());
return; return;
} }
@@ -93,7 +93,7 @@ impl UpdateMonitor {
match (&last_message, &conversation.last_message) { match (&last_message, &conversation.last_message) {
(Some(message), Some(conversation_message)) => { (Some(message), Some(conversation_message)) => {
if message.id == conversation_message.guid { if message.id == conversation_message.guid {
log::info!(target: target::UPDATES, "Skipping sync for conversation id: {}. We already have this message.", &conversation.guid); log::warn!(target: target::UPDATES, "Skipping sync for conversation id: {}. We already have this message.", &conversation.guid);
return; return;
} }
} }