Integrated: 1530: Race with CheckWorkItem in PR bot

Erik Joelsson erikj at
Mon Aug 8 13:45:33 UTC 2022

On Fri, 5 Aug 2022 21:49:18 GMT, Erik Joelsson <erikj at> 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.

This pull request has now been integrated.

Changeset: d7b59c6f
Author:    Erik Joelsson <erikj at>
Stats:     54 lines in 5 files changed: 19 ins; 8 del; 27 mod

1530: Race with CheckWorkItem in PR bot

Reviewed-by: kcr, ihse



More information about the skara-dev mailing list