问题描述:

I know the script limit is 360s but I am getting service unavailable for anything over 300s.

Here is the test code:

function testTimeOver () {

var startTime = (new Date()).getTime();

for (var i = 1; i <= 15; i++) {

Utilities.sleep(30100)

var currTime = (new Date()).getTime();

Logger.log(currTime - startTime);

if( currTime - startTime > 300000 )

{

SpreadsheetApp.getActiveSpreadsheet().toast('test', 'test', 3);

break;

}

}

}

function testTimeUnder () {

var startTime = (new Date()).getTime();

for (var i = 1; i <= 30; i++) {

Utilities.sleep(29100)

var currTime = (new Date()).getTime();

Logger.log(currTime - startTime);

if( currTime - startTime > 290000 )

{

SpreadsheetApp.getActiveSpreadsheet().toast('test', 'test', 3);

break;

}

}

}

testTimeOver () produces the error:

[16-11-07 09:35:03:444 EST] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]

[16-11-07 09:35:03:508 EST] Spreadsheet.toast([test, test, 3.0]) [0.063 seconds]

[16-11-07 09:35:03:553 EST] Execution failed: Service unavailable: Docs (line 11, file "Code") [301.531 seconds total runtime]

and testTimeUnder () does not:

[16-11-07 06:41:33:246 PST] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]

[16-11-07 06:41:33:347 PST] Spreadsheet.toast([test, test, 3.0]) [0.1 seconds]

[16-11-07 06:41:33:349 PST] Execution succeeded [291.321 seconds total runtime]

What's going on at 300s that is making the service unavailable?

网友答案:

It appears this issue has been reported:

https://code.google.com/p/google-apps-script-issues/issues/detail?id=6409&colspec=Stars%20Opened%20ID%20Type%20Status%20Summary%20Component%20Owner

相关阅读:
Top