chore: clean up compile warnings

This commit is contained in:
alyssa 2025-01-02 02:37:15 +00:00
parent 16ce67e02c
commit 89d6481ddb
16 changed files with 37 additions and 32 deletions

View file

@ -15,7 +15,6 @@ futures = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
sqlx = { workspace = true }
time = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
uuid = { workspace = true }

View file

@ -1,5 +1,5 @@
mod hash;
mod migrate;
// mod migrate;
mod process;
mod pull;
mod store;

View file

@ -1,7 +1,7 @@
use image::{DynamicImage, ImageFormat};
use std::borrow::Cow;
use std::io::Cursor;
use time::Instant;
use std::time::Instant;
use tracing::{debug, error, info, instrument};
use crate::{hash::Hash, ImageKind, PKAvatarError};
@ -100,10 +100,10 @@ pub fn process(data: &[u8], kind: ImageKind) -> Result<ProcessOutput, PKAvatarEr
"{}: lossy size {}K (parse: {} ms, decode: {} ms, resize: {} ms, encode: {} ms)",
encoded.hash,
encoded.data.len() / 1024,
(time_after_parse - time_before).whole_milliseconds(),
(time_after_decode - time_after_parse).whole_milliseconds(),
(time_after_resize - time_after_decode).whole_milliseconds(),
(time_after - time_after_resize).whole_milliseconds(),
(time_after_parse - time_before).as_millis(),
(time_after_decode - time_after_parse).as_millis(),
(time_after_resize - time_after_decode).as_millis(),
(time_after - time_after_resize).as_millis(),
);
debug!(
@ -198,7 +198,7 @@ fn process_gif_inner(
hash,
original_data.buffer().len() / 1024,
data.len() / 1024,
(time_after - time_before).whole_milliseconds(),
(time_after - time_before).as_millis(),
frame_count
);

View file

@ -1,14 +1,14 @@
use std::time::Duration;
use std::{str::FromStr, sync::Arc};
use crate::PKAvatarError;
use anyhow::Context;
use reqwest::{Client, ClientBuilder, StatusCode, Url};
use time::Instant;
use reqwest::{Client, StatusCode, Url};
use std::time::Instant;
use tracing::{error, instrument};
const MAX_SIZE: u64 = 8 * 1024 * 1024;
#[allow(dead_code)]
pub struct PullResult {
pub data: Vec<u8>,
pub content_type: String,
@ -85,16 +85,16 @@ pub async fn pull(
"{}: {} (headers: {}ms, body: {}ms)",
status,
&trimmed_url,
headers_time.whole_milliseconds(),
body_time.whole_milliseconds()
headers_time.as_millis(),
body_time.as_millis()
);
} else {
tracing::info!(
"{}: {} (headers: {}ms, body: {}ms)",
status,
&trimmed_url,
headers_time.whole_milliseconds(),
body_time.whole_milliseconds()
headers_time.as_millis(),
body_time.as_millis()
);
};
@ -105,6 +105,7 @@ pub async fn pull(
})
}
#[allow(dead_code)]
#[derive(Debug)]
pub struct ParsedUrl {
pub channel_id: u64,