From 82666f1382a0bf304c3dfe5ef432408ecadeb766 Mon Sep 17 00:00:00 2001 From: Martin Lowe <martin.lowe@eclipse-foundation.org> Date: Wed, 13 Nov 2024 10:39:59 -0500 Subject: [PATCH] fix: add pull request # to cache key for GH PR fetch Previously it only had the org + repo, which meant that different PRs would collide. --- .../eca/service/impl/DefaultGithubApplicationService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java b/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java index b575f69c..02bbc0f3 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java +++ b/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java @@ -119,8 +119,11 @@ public class DefaultGithubApplicationService implements GithubApplicationService @Override public Optional<PullRequest> getPullRequest(String installationId, String org, String repoName, Integer pullRequest) { String fullRepoName = GithubValidationHelper.getFullRepoName(org, repoName); + // create param map to better handle multiple PRs from a single repo in short time span + MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); + params.add(GitEcaParameterNames.PULL_REQUEST_NUMBER_RAW, Integer.toString(pullRequest)); return cache - .get(fullRepoName, new MultivaluedHashMap<>(), PullRequest.class, + .get(fullRepoName, params, PullRequest.class, () -> gh.getPullRequest(jwt.getGhBearerString(installationId), apiVersion, org, repoName, pullRequest)) .getData(); } -- GitLab