Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

956: Skara bot is continually trying to process the same PR command #1129

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -217,6 +217,14 @@ HttpResponse<String> send(String authId, HttpRequest.Builder requestBuilder) thr
}
try (var ignored = new LockWithTimeout(authLock)) {
return client.send(finalRequest, HttpResponse.BodyHandlers.ofString());
} finally {
// Invalidate any related GET caches
var postUriString = unauthenticatedRequest.uri().toString();
for (var cachedResponse : cachedResponses.keySet()) {
if (cachedResponse.unauthenticatedRequest.uri().toString().startsWith(postUriString)) {
cachedUpdated.put(cachedResponse, Instant.now().minus(Duration.ofDays(1)));
}
}
}
}
}
@@ -268,6 +268,38 @@ void cached() throws IOException {
}
}

@Test
void cacheFlush() throws IOException {
try (var receiver = new RestReceiver()) {
var request = new RestRequest(receiver.getEndpoint());
request.get("/test").execute();
assertFalse(receiver.usedCached());
request.post("/test").execute();
request.get("/test").execute();
assertFalse(receiver.usedCached());
var anotherRequest = new RestRequest(receiver.getEndpoint());
request.post("/test").execute();
anotherRequest.get("/test").execute();
assertFalse(receiver.usedCached());
}
}

@Test
void cacheFlushPartial() throws IOException {
try (var receiver = new RestReceiver()) {
var request = new RestRequest(receiver.getEndpoint());
request.get("/test?1").execute();
assertFalse(receiver.usedCached());
request.get("/test?1").execute();
assertTrue(receiver.usedCached());
request.post("/test").execute();
request.get("/test?1").execute();
assertFalse(receiver.usedCached());
request.get("/test?1").execute();
assertTrue(receiver.usedCached());
}
}

@Test
void cachedSeparateAuth() throws IOException {
try (var receiver = new RestReceiver()) {