Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add some logging to find cause of delay between fileuploads

  • Loading branch information...
commit beac43c71f8d8cb00fe56c94f72781c2da24b022 1 parent 4d5fee2
@linh81 linh81 authored
View
7 client/ext/uploadfiles/uploadfiles.js
@@ -188,6 +188,7 @@ module.exports = ext.register("ext/uploadfiles/uploadfiles", {
break;
case "debug":
console.log(JSON.stringify(data));
+ break;
default:
console.log("unknown message from uploadworker: ", data.type);
}
@@ -382,6 +383,7 @@ module.exports = ext.register("ext/uploadfiles/uploadfiles", {
},
addToQueue: function(file) {
+ console.log("addToQueue...", file.name);
// add files in dirty state
var parent = file.targetFolder;
var path = parent.getAttribute("path");
@@ -519,6 +521,7 @@ module.exports = ext.register("ext/uploadfiles/uploadfiles", {
/** Check for files exceeding filesize limit */
checkUploadSize: function(files) {
+ console.log("Checking file sizes of all files");
var file;
var files_too_big = [];
for (var filesize, totalsize = 0, i = 0, l = files.length; i < l; ++i) {
@@ -553,6 +556,7 @@ module.exports = ext.register("ext/uploadfiles/uploadfiles", {
/** Check the number of dropped files exceeds the limit */
checkNumberOfFiles: function(files) {
+ console.log("Checking number of files");
if (files.length > MAX_CONCURRENT_FILES) {
util.alert(
"Could not upload files", "An error occurred while dropping these files",
@@ -600,12 +604,15 @@ module.exports = ext.register("ext/uploadfiles/uploadfiles", {
},
onComplete: function() {
+ console.log("onComplete");
var _self = this;
var file = this.currentFile;
var path = file.path;
apf.xmldb.setAttribute(file.queueNode, "progress", "100");
+ console.log("webdav readdir...");
fs.webdav.exec("readdir", [path], function(data) {
+ console.log("webdav readdir done...");
if (data instanceof Error) {
// @todo: in case of error, show nice alert dialog.
return _self.uploadNextFile();
View
6 client/ext/uploadfiles/uploadworker.js
@@ -26,8 +26,9 @@ self.onmessage = function (e) {
// Processing ...
var reader = new FileReaderSync();
+ self.postMessage({type: "debug", filepath: filepath, value: "before readAsArrayBuffer"});
var file = reader.readAsArrayBuffer(data.file);
-
+ self.postMessage({type: "debug", filepath: filepath, value: "after readAsArrayBuffer"});
var blob = file;
var blobsize = blob.byteLength;
@@ -68,12 +69,13 @@ self.onmessage = function (e) {
// uploading file in chunks
self.uploadChunk = function(chunk, filepath, end, blobsize, next) {
+ self.postMessage({type: "debug", filepath: filepath, value: "start uploadChunk"});
var http = new XMLHttpRequest();
http.open("PUT", filepath, true);
http.onreadystatechange = function(){
if (http.readyState != 4)
return;
-
+ self.postMessage({type: "debug", filepath: filepath, value: "end uploadChunk"});
if (end == blobsize) {
// file upload complete
delete connections[filepath];
Please sign in to comment.
Something went wrong with that request. Please try again.