お世話になっております。
瀧と申します。
ご教示のほどよろしくお願いします。
現在、GASで社内システム(WEBアプリ)を作成しているのですが、
スクリプトのランタイムエラーが発生しております。
GASの制限を見るとスクリプトのランタイムは「6 分 / 実行」とありますが、
2分待機(Utilities.sleep(120000))しただけで、6分後に上記エラーが発生します。
現象は以下の通りです。
・getは5分スリープでも正常に表示
・postは 2分待機(Utilities.sleep(120000)) で 6分後に上記エラー発生
・postで1分59秒待機(Utilities.sleep(119000))なら正常に画面表示されます。
・他のユーザー環境でも同現象発生
また、実行数を見ると、
・バージョン8は、get(2分)/post(1分59秒)で正常表示
・バージョン9は、get(2分)/post(2分)でエラーになりますが、postが3回実行されています。
つまり、2分×3回で6分のスクリプトランタイムエラーになってると思われます。
#実行ボタンは1度しかクリックしていません。
postでの2分はGoogleの仕様なのでしょうか。
因みに、社内システム側のform methodをpostからgetに切り替えましたが、
getでも2分経つと処理を中断して次のgetが起動し、延々とgetが起動されてしまいます。
ソースコードは以下の通りです。
------------
------------
function doGet(e) {
let template = HtmlService.createTemplateFromFile('index');
return template.evaluate();
}
function doPost(e) {
template = HtmlService.createTemplateFromFile("result");
return template.evaluate();
}
------------
index.html
------------
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?
Utilities.sleep(300000);・・・正常に表示される
?>
5分経ちました
テスト<br>
<form action="
【 URL 】" method="post" >
<div align="center"><input id='btn' type="submit" value="実行"></div>
</form>
</body>
</html>
------------
result.html
------------
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<?
Utilities.sleep(120000);・・・2分まっても表示されず6分後にランタイムエラー
?>
2分経ちました
</body>
</html>