Skip to content

Commit e0e989e

Browse files
Merge pull request #19 from nextcloud/upload_bigfiles
Increase the last chunk timeout in uploads
2 parents 3a81bd5 + 70228c3 commit e0e989e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Binary file not shown.

src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747

4848

4949
public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation {
50-
50+
51+
private static final int LAST_CHUNK_TIMEOUT = 900000; //15 mins.
52+
5153
public static final long CHUNK_SIZE = 1024000;
5254
private static final String OC_CHUNKED_HEADER = "OC-Chunked";
5355
private static final String OC_CHUNK_SIZE_HEADER = "OC-Chunk-Size";
@@ -114,6 +116,14 @@ protected int uploadFile(OwnCloudClient client) throws IOException {
114116
mPutMethod.abort();
115117
// next method will throw an exception
116118
}
119+
120+
if (chunkIndex == chunkCount - 1) {
121+
// Added a high timeout to the last chunk due to when the last chunk
122+
// arrives to the server with the last PUT, all chunks get assembled
123+
// within that PHP request, so last one takes longer.
124+
mPutMethod.getParams().setSoTimeout(LAST_CHUNK_TIMEOUT);
125+
}
126+
117127
status = client.executeMethod(mPutMethod);
118128

119129
if (status == 400) {

0 commit comments

Comments
 (0)