Skip to content

Commit 9633ea7

Browse files
Merge pull request #104 from duosecurity/fix/close-429-response-before-retry
Close intermediate 429 responses before retry
1 parent 6e3394a commit 9633ea7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • duo-client/src/main/java/com/duosecurity/client

duo-client/src/main/java/com/duosecurity/client/Http.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ private Response executeRequest(Request request) throws Exception {
319319
return response;
320320
}
321321

322+
// Close the 429 response to release the connection back to the pool before retrying
323+
if (response.body() != null) {
324+
response.close();
325+
}
322326
sleep(backoffMs + nextRandomInt(1000));
323327
backoffMs *= BACKOFF_FACTOR;
324328
}

0 commit comments

Comments
 (0)