You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/07/10 22:08:22 UTC

[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #5351: GEODE-8338: Redis commands may be repeated when server dies

jdeppe-pivotal commented on a change in pull request #5351:
URL: https://github.com/apache/geode/pull/5351#discussion_r453099239



##########
File path: geode-redis/src/distributedTest/java/org/apache/geode/redis/session/SessionDUnitTest.java
##########
@@ -144,26 +146,51 @@ protected String createNewSessionWithNote(int sessionApp, String note) {
     HttpHeaders requestHeaders = new HttpHeaders();
     requestHeaders.add("Cookie", sessionCookie);
     HttpEntity<String> request2 = new HttpEntity<>("", requestHeaders);
-
-    return new RestTemplate()
-        .exchange(
-            "http://localhost:" + ports.get(sessionApp) + "/getSessionNotes",
-            HttpMethod.GET,
-            request2,
-            String[].class)
-        .getBody();
+    boolean sesssionObtained = false;
+    String[] responseBody = new String[0];
+    do {
+      try {
+        responseBody = new RestTemplate()
+            .exchange(
+                "http://localhost:" + ports.get(sessionApp) + "/getSessionNotes",
+                HttpMethod.GET,
+                request2,
+                String[].class)
+            .getBody();
+        sesssionObtained = true;
+      } catch (HttpServerErrorException e) {
+        if (e.getMessage().contains("Internal Server Error")) {
+          // retry
+        } else {
+          throw e;
+        }
+      }
+    } while (!sesssionObtained);
+    return responseBody;

Review comment:
       I'd prefer to see this retry logic happen in the Controller, but we can make that change later.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org