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

Upgrade the notifier database lazily #657

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
@@ -191,13 +191,14 @@ public Collection<WorkItem> run(Path scratchPath) {
var storedState = stored.stream()
.filter(ss -> ss.prId().equals(state.prId()))
.findAny();
if (storedState.isPresent()) {
// The stored entry could be old and be missing commit information - if so, upgrade it
if (storedState.get().commitId().isPresent() && storedState.get().commitId().get().equals(Hash.zero())) {
var hash = resultingCommitHashFor(pr);
storedState = Optional.of(new PullRequestState(pr, issues, hash));
}
// The stored entry could be old and be missing commit information - if so, upgrade it
if (storedState.isPresent() && storedState.get().commitId().equals(Optional.of(Hash.zero()))) {
var hash = resultingCommitHashFor(pr);
storedState = Optional.of(new PullRequestState(pr, storedState.get().issueIds(), hash));
storage.put(storedState.get());
}

if (storedState.isPresent()) {
var storedIssues = storedState.get().issueIds();
storedIssues.stream()
.filter(issue -> !issues.contains(issue))