google apps script - What is driveWriteVolume rateMax? -


i started getting exception:

drivewritevolume ratemax. try utilities.sleep(1000) between calls 

usually means i'm trying access service in repetition. however, have never seen message before , searches have made don't return useful information it.

here best mockup without pasting 100 lines of code:

function compilelabel(){    var doc = docslist.createfile('my label', '', 'text/html');    var threads = gmailapp.getuserlabelbyname('my label');     var starttime = date.now();    while((date.now() - starttime) < 240000){       for(t in threads){         var messages = threads[t].getmessages();         var threadheader = createthreadheader(); //builds html representation of thread info string         doc.append(threadheader);          for(m in messages){            var msgheader = createmessageheader(); //builds html representation header info string            doc.append(msgheader);            doc.append(messages[i].getbody());             var attachments = messages[m].getattachments();            if(attachments.length > 0){               var attachmentfolder = parentfolder.createfolder(messages[m].getsubject());            }            for(a in attachments){              attachmentfolder.createfile(attachments[a]);            }         }      }    }     parentfolder.createfile(doc.getas('application/pdf')); //this intermittantly throwing exception serialization now, that's different issue.    //after time based loop, more things don't have docslist based functions } 

as of 2 days ago, worked well. now, unless sleep(1000) before every doc.append(), createfile() or createfolder(), produces error. can provide project key if necessary.

i discovered same error mails today, apparently exceeded allowed upload rate google drive. fix had increase sleep time 3000 (i using 1000). piece of code caused error:

  var att = messages[y].getattachments();    var attlinks = [];     (var z=0; z<att.length; z++) {     try {       var file = folder.createfile(att[z]); //create file in gdrive       attlinks.push('<a href="'+file.geturl()+'" target="_blank" alt="'+file.getname()+'">'+file.getname()+'</a>'); //push link array       utilities.sleep(3000); //increased 1000 3000     } 

update

i had increase sleep time once more (to 10s) because issue still occurred when there more 5 attachments.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -