Skip to content

Commit

Permalink
We can ignore extra files in save-tweets (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown authored Nov 4, 2021
1 parent ecbd8dc commit 5377c39
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/wbm/tweet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,18 @@ fn extract_tweets_from_path<P: AsRef<Path>>(
}

pub async fn export_tweets(store: &ValidStore, tweet_store: &db::TweetStore) -> Result<()> {
use futures::TryStreamExt;
use futures::{StreamExt, TryStreamExt};

Ok(
futures::stream::iter(store.paths().map(|result| result.map_err(Error::from)))
.filter_map(|res| async {
match res {
Err(Error::ValidStoreError(super::valid::Error::Unexpected { path: _ })) => {
None
}
other => Some(other),
}
})
.try_for_each_concurrent(4, |(digest, path)| async move {
if tweet_store.check_digest(&digest).await?.is_none() {
let ts = tweet_store.clone();
Expand Down

0 comments on commit 5377c39

Please sign in to comment.