Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse older conversations, but only the most recent messages #498

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -57,7 +57,7 @@ public boolean concurrentWith(WorkItem other) {
@Override
public void run(Path scratchPath) {
// Give the bot a chance to act on all found messages
var conversations = list.conversations(Duration.ofDays(60));
var conversations = list.conversations(Duration.ofDays(365));
for (var conversation : conversations) {
bot.inspect(conversation);
}
@@ -27,6 +27,7 @@
import org.openjdk.skara.forge.*;
import org.openjdk.skara.mailinglist.*;

import java.time.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.logging.Logger;
@@ -92,8 +93,10 @@ synchronized void inspect(Conversation conversation) {
parsedEmailIds.remove(first.id());
}

// Are there any new messages?
// Are there any new messages? We avoid looking further back than 14 days. If the bridge has been down
// for more than 14 days, this may have to be temporarily increased.
var newMessages = conversation.allMessages().stream()
.filter(email -> email.date().isAfter(ZonedDateTime.now().minus(Duration.ofDays(14))))
.filter(email -> !parsedEmailIds.contains(email.id()))
.collect(Collectors.toList());
if (newMessages.isEmpty()) {