Log warning if no more articles on Pocket

This commit is contained in:
Robert Carosi
2024-09-29 11:22:06 +02:00
parent d99e2386a7
commit 3a1a87c6d1

View File

@@ -42,12 +42,16 @@ final class DownloadService {
nArticlesOnRm,
total);
AtomicInteger count = new AtomicInteger(1);
return articles.stream()
List<Path> downloads = articles.stream()
.filter(article -> validator.isValid(article.title()))
.map(article -> tryDownload(article, count, total))
.flatMap(Optional::stream)
.limit(limit)
.toList();
if(downloads.size() < total) {
LOG.warn("No more articles on Pocket. Add some new ones!");
}
return downloads;
}
private Optional<Path> tryDownload(Article article, AtomicInteger count, int total) {