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

Commit

Permalink
fix(concurrent chunking): add more logging to help figure out where t…
Browse files Browse the repository at this point in the history
…he issue lies

#1519
  • Loading branch information
rnicholus committed Feb 16, 2016
1 parent 18e1310 commit 14633b3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Fine Uploader](http://fineuploader.com/img/FineUploader_logo.png)](http://fineuploader.com/)

Version: 5.5.1-1
Version: 5.5.1-2

[![Build Status](https://travis-ci.org/FineUploader/fine-uploader.png?branch=master)](https://travis-ci.org/FineUploader/fine-uploader) | [![Semver badge](http://calm-shore-6115.herokuapp.com/?label=SemVer&value=2.0.0&color=green)](http://semver.org/spec/v2.0.0.html)

Expand Down
12 changes: 9 additions & 3 deletions client/js/upload-handler/upload.handler.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ qq.UploadHandlerController = function(o, namespace) {

// Send the next chunk
else {
log("Sending chunked upload request for item " + id + ": bytes " + (chunkData.start + 1) + "-" + chunkData.end + " of " + size);
log(qq.format("Sending chunked upload request for item {}.{}, bytes {}-{} of {}.", id, chunkIdx, chunkData.start + 1, chunkData.end, size));
options.onUploadChunk(id, name, handler._getChunkDataForCallback(chunkData));

log(qq.format("Marking item {}.{} as in-progress among these existing in-progress chunks: {}. These chunks are still remaining: {}", id, chunkIdx, JSON.stringify(inProgressChunks), JSON.stringify(handler._getFileState(id).chunking.remaining)));
inProgressChunks.push(chunkIdx);
handler._getFileState(id).chunking.inProgress = inProgressChunks;

Expand All @@ -158,14 +159,16 @@ qq.UploadHandlerController = function(o, namespace) {

var inProgressChunks = handler._getFileState(id).chunking.inProgress || [],
responseToReport = upload.normalizeResponse(response, true),
inProgressChunkIdx = qq.indexOf(inProgressChunks, chunkIdx);
inProgressChunkIdx = qq.indexOf(inProgressChunks, chunkIdx),
completedChunk;

log(qq.format("Chunk {} for file {} uploaded successfully.", chunkIdx, id));

chunked.done(id, chunkIdx, responseToReport, xhr);

if (inProgressChunkIdx >= 0) {
inProgressChunks.splice(inProgressChunkIdx, 1);
completedChunk = inProgressChunks.splice(inProgressChunkIdx, 1);
log(qq.format("Successfully uploaded item {}.{} has been removed from in progress chunk queue, which now look like this: {}", id, completedChunk, JSON.stringify(inProgressChunks)));
}

handler._maybePersistChunkedState(id);
Expand Down Expand Up @@ -209,7 +212,9 @@ qq.UploadHandlerController = function(o, namespace) {
if (concurrentChunkingPossible) {
handler._getFileState(id).temp.ignoreFailure = true;

log(qq.format("Going to attempt to abort these chunks: {}. These are currently in-progress: {}, and these are remaining: {}.", JSON.stringify(Object.keys(handler._getXhrs(id))), JSON.stringify(handler._getFileState(id).chunking.inProgress), JSON.stringify(handler._getFileState(id).chunking.remaining)));
qq.each(handler._getXhrs(id), function(ckid, ckXhr) {
log(qq.format("Attempting to abort file {}.{}. XHR readyState {}. ", id, ckid, ckXhr.readyState));
ckXhr.abort();
});

Expand Down Expand Up @@ -264,6 +269,7 @@ qq.UploadHandlerController = function(o, namespace) {
connectionsIndex = qq.indexOf(connectionManager._open, id),
nextId;

log("Deleting these open chunks from connection manager: " + JSON.stringify(connectionManager._openChunks[id]));
delete connectionManager._openChunks[id];

if (upload.getProxyOrBlob(id) instanceof qq.BlobProxy) {
Expand Down
1 change: 1 addition & 0 deletions client/js/upload-handler/xhr.upload.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ qq.XhrUploadHandler = function(spec) {
remaining = optRemaining || handler._getFileState(id).chunking.remaining;

if (inProgress) {
log(qq.format("Moving these chunks from in-progress {}, to remaining {}.", JSON.stringify(inProgress), JSON.stringify(remaining)));
inProgress.reverse();
qq.each(inProgress, function(idx, chunkIdx) {
remaining.unshift(chunkIdx);
Expand Down
2 changes: 1 addition & 1 deletion client/js/version.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/*global qq */
qq.version = "5.5.1-1";
qq.version = "5.5.1-2";
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fine-uploader",
"title": "Fine Uploader",
"version": "5.5.1-1",
"version": "5.5.1-2",
"description": "Multiple file upload component with progress-bar, drag-and-drop, support for all modern browsers.",
"main": "./fine-uploader/js/fineuploader.js",
"directories": {
Expand Down

0 comments on commit 14633b3

Please sign in to comment.