Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Original request in Retry Policy #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/android/volley/DefaultRetryPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public float getBackoffMultiplier() {
* @param error The error code of the last attempt.
*/
@Override
public void retry(VolleyError error) throws VolleyError {
public void retry(VolleyError error, Request request) throws VolleyError {
mCurrentRetryCount++;
mCurrentTimeoutMs += (mCurrentTimeoutMs * mBackoffMultiplier);
if (!hasAttemptRemaining()) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/android/volley/RetryPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public interface RetryPolicy {
/**
* Prepares for the next retry by applying a backoff to the timeout.
* @param error The error code of the last attempt.
* @param request The request that caused the retry.
* @throws VolleyError In the event that the retry could not be performed (for example if we
* ran out of attempts), the passed in error is thrown.
*/
public void retry(VolleyError error) throws VolleyError;
public void retry(VolleyError error, Request request) throws VolleyError;
}
2 changes: 1 addition & 1 deletion src/main/java/com/android/volley/toolbox/BasicNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private static void attemptRetryOnException(String logPrefix, Request<?> request
int oldTimeout = request.getTimeoutMs();

try {
retryPolicy.retry(exception);
retryPolicy.retry(exception, request);
} catch (VolleyError e) {
request.addMarker(
String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
Expand Down