0

I am working on a site that involves uploading songs, and I'm saving the songs with Parse, using this code:

var parseFile = new Parse.File(fileName, file);
    parseFile.save().then(function() {
        // The file has been saved to Parse.
        saveToServer(songName, parseFile);
    }, function(error) {
        // The file either could not be read, or
        // could not be saved to Parse.
        alert(songName + " couldn't be saved, beacuse: " + error.message);
    });

For some reason, that code takes an excessive amount of time to run (e.g., 20 minutes for 12 songs).

I have tried to use setTimeout for every song so they will be saved in parallel, but that doesn't improve anything.

I found Parse.com save slow with pointers to files but the problem described there is different than mine.

Does anyone knows if there is any way to speed it up what I'm trying? Or maybe it's impossible with Parse?

Community
  • 1
  • 1
Chaked
  • 1
  • 2
  • 2
    Surely it just depends on your connection speed? If you upload all songs concurrently, it will just upload slower per song, as the total bandwidth will be the same anyway. – SteveEdson Sep 22 '15 at 11:12
  • 1
    [Javascript is *typically* always single threaded](http://stackoverflow.com/questions/21718774/how-is-javascript-single-threaded) and therefore **never runs in parallel**. Settimeout is only deffering the execution of a function, and therefore will just make things worse – Liam Sep 22 '15 at 11:14
  • how big are the files please, user3 ? – Fattie Sep 22 '15 at 11:28
  • Those r songs of 5-10 mb. maybe u guys r right and I should fond a workaround like uploadin in the background or something.. – Chaked Jan 04 '16 at 08:11

0 Answers0