RFR: 1530: Race with CheckWorkItem in PR bot

Erik Joelsson erikj at openjdk.org
Fri Aug 5 21:53:23 UTC 2022


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.

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

Commit messages:
 - SKARA-1530

Changes: https://git.openjdk.org/skara/pull/1349/files
 Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1349&range=00
  Issue: https://bugs.openjdk.org/browse/SKARA-1530
  Stats: 54 lines in 5 files changed: 19 ins; 8 del; 27 mod
  Patch: https://git.openjdk.org/skara/pull/1349.diff
  Fetch: git fetch https://git.openjdk.org/skara pull/1349/head:pull/1349

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


More information about the skara-dev mailing list