RFR: 1530: Race with CheckWorkItem in PR bot

Magnus Ihse Bursie ihse at openjdk.org
Mon Aug 8 09:07:14 UTC 2022


On Fri, 5 Aug 2022 21:49:18 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> This patch fixes a race in the PR bot. 
> 
> Currently, all WorkItems that process PRs get an instance of the PullRequest that was  fetched before the WorkItem instance was created. The data in that PullRequest instance (the parts that aren't dynamically fetched on method calls) may then be stale before the WorkItem even starts running.
> 
> With this patch, I'm changing PullRequestWorkItem (the super class of all WorkItems that handle PRs), to only be instantiated with the ID of the PR, and then fetches the actual PullRequest object at the start of the `run()` method. When the `run()` method is called, we are guaranteed to be the only WorkItem currently processing the particular PR, so fetching data there should guarantee a coherent and current view.
> 
> In many cases where PullRequestWorkItems were created, the creator first refreshed the PullRequest object to provide an updated view, reflecting any changes made by the creator. These refreshes are no longer necessary, so I've removed them all.

Looks good. Tricky one!

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

Marked as reviewed by ihse (Reviewer).

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


More information about the skara-dev mailing list