Skip to content

Commit 4c6bf2d

Browse files
committed
- removes manually implemented retrial for uploads as this is implemented by interceptor and by http client
1 parent ec978f8 commit 4c6bf2d

File tree

1 file changed

+14
-25
lines changed

1 file changed

+14
-25
lines changed

src/main/java/com/microsoft/graph/requests/extensions/ChunkedUploadRequest.java

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,32 +98,21 @@ public ChunkedUploadRequest(final String requestUrl,
9898
@SuppressWarnings("unchecked")
9999
public <UploadType> ChunkedUploadResult<UploadType> upload(
100100
final ChunkedUploadResponseHandler<UploadType> responseHandler) {
101-
while (this.retryCount < this.maxRetry) {
102-
try {
103-
Thread.sleep(RETRY_DELAY * this.retryCount * this.retryCount);
104-
} catch (final InterruptedException e) {
105-
throw new ClientException("Exception while waiting to retry file upload.", e);
106-
}
107-
108-
ChunkedUploadResult<UploadType> result = null;
109-
110-
try {
111-
result = this.baseRequest
112-
.getClient()
113-
.getHttpProvider()
114-
.send(baseRequest, (Class<ChunkedUploadResult<UploadType>>)(Class<?>) ChunkedUploadResult.class, this.data, responseHandler);
115-
} catch (final ClientException e) {
116-
throw new ClientException("Request failed with error, retry if necessary.", e);
117-
}
118-
119-
if (result != null && result.chunkCompleted()) {
120-
return result;
121-
}
122-
123-
this.retryCount++;
101+
ChunkedUploadResult<UploadType> result = null;
102+
103+
try {
104+
result = this.baseRequest
105+
.getClient()
106+
.getHttpProvider()
107+
.send(baseRequest, (Class<ChunkedUploadResult<UploadType>>)(Class<?>) ChunkedUploadResult.class, this.data, responseHandler);
108+
} catch (final ClientException e) {
109+
throw new ClientException("Request failed with error, retry if necessary.", e);
124110
}
125111

126-
return new ChunkedUploadResult<UploadType>(
127-
new ClientException("Upload session failed too many times.", null));
112+
if (result != null && result.chunkCompleted()) {
113+
return result;
114+
} else
115+
return new ChunkedUploadResult<UploadType>(
116+
new ClientException("Upload session failed.", null));
128117
}
129118
}

0 commit comments

Comments
 (0)