diff --git a/fuzzysearch-ingest-weasyl/src/main.rs b/fuzzysearch-ingest-weasyl/src/main.rs index 0d8f075..7bee1bd 100644 --- a/fuzzysearch-ingest-weasyl/src/main.rs +++ b/fuzzysearch-ingest-weasyl/src/main.rs @@ -50,6 +50,7 @@ enum WeasylResponse { Response(T), } +#[tracing::instrument(skip(client, api_key))] async fn load_frontpage(client: &reqwest::Client, api_key: &str) -> anyhow::Result { let resp: WeasylResponse> = client .get("https://www.weasyl.com/api/submissions/frontpage") @@ -96,7 +97,10 @@ async fn load_submission( let data: WeasylResponse = match serde_json::from_value(body.clone()) { Ok(data) => data, - Err(_err) => return Ok((None, body)), + Err(err) => { + tracing::error!("Unable to parse submission: {:?}", err); + return Ok((None, body)); + } }; let res = match data { @@ -225,6 +229,8 @@ async fn main() { let max = load_frontpage(&client, &api_key).await.unwrap(); + tracing::info!(min, max, "Calculated range of submissions to check"); + for id in (min + 1)..=max { let row: Option<_> = sqlx::query!("SELECT id FROM weasyl WHERE id = $1", id) .fetch_optional(&pool)