RFR: 1532: CSRBot is too inefficient [v2]

Erik Joelsson erikj at openjdk.org
Mon Aug 15 17:23:34 UTC 2022

On Mon, 15 Aug 2022 17:00:53 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> bots/csr/src/main/java/org/openjdk/skara/bots/csr/CSRIssueBot.java line 73:
>>> 71:             if (issue.updatedAt().isAfter(lastUpdatedAt)) {
>>> 72:                 lastUpdatedAt = issue.updatedAt();
>>> 73:             }
>> A race condition may let the bot ignore some updated issues. Considering the following situation:
>> step 1: the method `issueProject.csrIssues` get the issue-1 and issue-2 at time 00:00:001
>> step 2: the issue-3 is updated at 00:00:002 and the issue-2 is updated at 00:00:003
>> step 3: at time 00:00:004, the statement `lastUpdatedAt = issue.updatedAt();` is run and updates the lastUpdatedAt to 00:00:003, then in the next round, the issue-3 will be ignored.
> Your scenario should not be possible. If Issue-2 is updated at 00:00:003, then that update will not be included in the call in step 1, so issue-2.updatedAt() will not return 00:00:003, it will return an older value, as it was recorded at 00:00:001. This is why I only use the issue.updatedAt() values for `lastUpdatedAt`, so that I can be sure that the timestamps originate from the remote service (Jira) and can never be newer/later than when the data was gathered.

In case you missed it, `JiraIssue.updatedAt()` does not call out to the remote service, it just reads the cached json.


PR: https://git.openjdk.org/skara/pull/1357

More information about the skara-dev mailing list