RFR: 2015: Initial run of PR IssueBot misses issue updates

Zhao Song zsong at openjdk.org
Tue Sep 12 17:24:57 UTC 2023


On Tue, 12 Sep 2023 17:00:58 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> Currently, if pullRequestBot is down for more than 10 minutes and during that time, if users make changes to some issues, than the update activities would not trigger CheckWorkItem after the bot restarts.
>> 
>> To solve this problem, In this patch, after the bot restarts, in the initial run, pullRequestBot would make CheckWorkItem compare both prMetaData and issueMetaData.
>
> bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 232:
> 
>> 230:                         if (previousIssueMetadata.equals(currIssueMetadata) && expiresAt.isAfter(Instant.now())) {
>> 231:                             log.finer("[Issue]Metadata with expiration time is still valid, not checking again");
>> 232:                             return true;
> 
> I think this method would be easier to read if we kept all return `true`/`false` inside the conditional blocks. If we know we have a terminal state, lets be clear about it so the reader doesn't need to check the rest of the method.

I removed `return true` here because we couldn't return early in this block. For the initial run case, `initialRun` would be true and `spawnedFromIssueBot` would be false. We need to check both issueMetaData and PRMetaData. 

But we could add some `return true` in `if (!spawnedFromIssueBot)` block.

-------------

PR Review Comment: https://git.openjdk.org/skara/pull/1554#discussion_r1323349702


More information about the skara-dev mailing list