RFR: 1629: Limit how far back maxUpdatedAt can be set in PullRequestPoller

Erik Helin ehelin at openjdk.org
Thu Oct 13 13:52:57 UTC 2022


On Tue, 11 Oct 2022 21:09:55 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> After having observed the PullRequestPoller in action for a bit, I've noticed some weird behavior. Say a very old open PR A exists, and there is a closed PR B that is newer (but older than the 7 day initial query limit). Then on the first round, PR A will be returned and maxUpdatedAt will be set to updatedAt of PR A. On the second round, this will cause PR B to be returned. This is causing some weird behavior, resurrecting very old closed PRs that have problems with them.
> 
> This patch fixes this by putting a hard limit on how far back we query for the updatedAt field.

Looks good, just a minor comment: given that `UPDATED_AT_QUERY_LIMIT` now is a `ZonedDateTime` instead of a `Duration` you might get PRs that are older than 7 days _if_ the same bots are up and running for a long period of time (as in if we do not restart them). That is because `UPDATED_AT_QUERY_LIMIT` is `static final` and will be set to a timestamp 7 days prior to the JVM being started (more or less). Now if the JVM has been running for 2 days, then we will actually get PRs that might be 9 days old. Not sure if this matter given that we deploy quite frequently, but you might want to update `UPDATED_AT_QUERY_LIMIT` every time in `updatedPullRequests`.

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

Marked as reviewed by ehelin (Reviewer).

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


More information about the skara-dev mailing list