Only crawl new entries
This commit is contained in:
parent
923776d7a1
commit
0fa0cfc508
@ -135,9 +135,12 @@ impl FeedCrawler {
|
|||||||
let entries = upsert_entries(&self.pool, payload)
|
let entries = upsert_entries(&self.pool, payload)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| FeedCrawlerError::CreateFeedEntriesError(url.clone()))?;
|
.map_err(|_| FeedCrawlerError::CreateFeedEntriesError(url.clone()))?;
|
||||||
info!("Created {} entries", entries.len());
|
let (new, updated) = entries
|
||||||
|
.into_iter()
|
||||||
|
.partition::<Vec<_>, _>(|entry| entry.updated_at.is_none());
|
||||||
|
info!(new = new.len(), updated = updated.len(), "saved entries");
|
||||||
|
|
||||||
for entry in entries {
|
for entry in new {
|
||||||
let entry_crawler = EntryCrawlerHandle::new(
|
let entry_crawler = EntryCrawlerHandle::new(
|
||||||
self.pool.clone(),
|
self.pool.clone(),
|
||||||
self.client.clone(),
|
self.client.clone(),
|
||||||
|
Loading…
Reference in New Issue
Block a user