Skip to content

Commit

Permalink
Process the last 48h of posts to re-try summarization
Browse files Browse the repository at this point in the history
  • Loading branch information
mithandir committed Jun 26, 2024
1 parent c4f836b commit d30a9a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MlController {

@PostConstruct
public void fixQueueAfterRestart() {
var todaysNews = mongo.findAllPostedToday();
var todaysNews = mongo.findLast100PostsPostedInTheLast48h();
todaysNews.stream()
.filter(news -> news.getSummary() == null || news.getSummary().isBlank())
.filter(news -> news.getContent() != null && !news.getContent().isBlank() && news.getContent().length() > 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public List<NewsEntry> findAllFilterdBySite(String host) {
return template.find(query, NewsEntry.class);
}

public List<NewsEntry> findAllPostedToday() {
public List<NewsEntry> findLast100PostsPostedInTheLast48h() {
Query query = new Query();
query.addCriteria(Criteria.where("publishedAt").gte(ZonedDateTime.now().truncatedTo(ChronoUnit.DAYS).toInstant()));
query.addCriteria(Criteria.where("publishedAt").gte(ZonedDateTime.now().minusDays(2).toInstant()));
query.with(Sort.by(Sort.Direction.DESC, "publishedAt"));
query.limit(100);
query.maxTimeMsec(1000);
Expand Down

0 comments on commit d30a9a1

Please sign in to comment.