From 63e1e1f4406d1737bf5d0476d36ca0f3362358e7 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 11 Nov 2024 00:29:08 +0100 Subject: [PATCH] fix: iter nodes not inner vals, remove logs --- upub/core/src/traits/fetch.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/upub/core/src/traits/fetch.rs b/upub/core/src/traits/fetch.rs index 89a3a06..27b80ad 100644 --- a/upub/core/src/traits/fetch.rs +++ b/upub/core/src/traits/fetch.rs @@ -402,19 +402,14 @@ impl Fetcher for crate::Context { } async fn fetch_thread(&self, id: &str, tx: &impl ConnectionTrait) -> Result<(), RequestError> { - tracing::info!("crawling replies of '{id}'"); let object = self.pull(id).await?.object()?; - tracing::info!("pulled object {object:?}"); let replies = object.replies().resolve(self).await?; - tracing::info!("resolved replies {replies:?}"); let mut page; let mut next = replies.first(); - tracing::info!("first next: {next:?}"); loop { page = next.resolve(self).await?; - tracing::info!("resolved next page: {page:?}"); // fix for mastodon: at some point it introduces ?only_other_accounts=true and then returns a // collection, not a page anymore ??? @@ -422,20 +417,19 @@ impl Fetcher for crate::Context { page = page.first().extract().ok_or(RequestError::Tombstone)?; } - for obj in page.items() { + for obj in page.items().flat() { if let Err(e) = self.fetch_object(obj.id()?, tx).await { tracing::warn!("error fetching reply: {e}"); } } - for obj in page.ordered_items() { + for obj in page.ordered_items().flat() { if let Err(e) = self.fetch_object(obj.id()?, tx).await { tracing::warn!("error fetching reply: {e}"); } } next = page.next(); - tracing::info!("next page: {next:?}"); if next.is_empty() { break }; }