Skip to content
Snippets Groups Projects
Commit 82666f13 authored by Martin Lowe's avatar Martin Lowe :no_entry:
Browse files

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.
parent c58d2779
No related branches found
No related tags found
1 merge request!212fix: Update GH revalidation logic to use new split repo + org name params
Pipeline #59032 passed
...@@ -119,8 +119,11 @@ public class DefaultGithubApplicationService implements GithubApplicationService ...@@ -119,8 +119,11 @@ public class DefaultGithubApplicationService implements GithubApplicationService
@Override @Override
public Optional<PullRequest> getPullRequest(String installationId, String org, String repoName, Integer pullRequest) { public Optional<PullRequest> getPullRequest(String installationId, String org, String repoName, Integer pullRequest) {
String fullRepoName = GithubValidationHelper.getFullRepoName(org, repoName); 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 return cache
.get(fullRepoName, new MultivaluedHashMap<>(), PullRequest.class, .get(fullRepoName, params, PullRequest.class,
() -> gh.getPullRequest(jwt.getGhBearerString(installationId), apiVersion, org, repoName, pullRequest)) () -> gh.getPullRequest(jwt.getGhBearerString(installationId), apiVersion, org, repoName, pullRequest))
.getData(); .getData();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment