大佬教程收集整理的这篇文章主要介绍了Google Apps 脚本(似乎)在循环中随机挂起(圆圈图标无限期运行),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我没有很好地解释问题。挂起行为似乎与使用控制台日志记录(使用 Logger.log 或 console.log 语句)有关。如果我注释掉日志语句,则不会发生挂起行为。因此,如果我放入断点,循环代码将在单击“恢复”后在断点处停止一次或几次,然后在不返回断点的情况下挂起。在挂起行为发生之前成功击中断点的次数似乎是随机的。因此,问题似乎与循环中的控制台日志记录有关。如果我删除日志语句,则不会发生挂起行为。感谢您的任何建议,在这里。
当设置断点时,我有一个循环挂在调试器中(但在没有设置断点时似乎不会)。我试过在不同的位置放置断点,然后跳过断点语句,然后继续执行。有时(随机)它永远不会返回到断点并且永远运行(直到超时)。这是我的代码。任何人都可以看到发生了什么。谢谢。
function getHikesDataBymonth() {
var firstHikeMonth = events[1][0].getMonth();
var thisHikeMonth = firstHikeMonth;
//var hikescolumn = firstHikeMonth;
var hikeDate,hikeDay,hikename,hikeLevel,hikenameShort;
var hikeMonth,newHikeMonth;
var eventRow = 1;
var hikeRow = 0;
var participantnumber = 0;
var numParticipants;
var hikeData = [];
var hikescolumn = [];
var hikeDate,hikenameShort,hikeLevel;
Logger.log("events.length " + events.length)
while (eventRow < events.length) {
//if (events[eventRow][4].isBlank) { break;}
if ((!events[eventRow][4].includes("hike") && !events[eventRow][4].includes("Hike") && !events[eventRow][4].includes("HIKE")) || events[eventRow][4].includes("CANCEL")) {
eventRow += 1;
conTinue;
}
// found a hike
console.log("Found Hike: " + events[eventRow][4]);
hikename = events[eventRow][4];
hikeMonth = events[eventRow][0].getMonth() - firstHikeMonth;
if (hikeMonth > thisHikeMonth - firstHikeMonth) {
newHikeMonth = true;
thisHikeMonth = hikeMonth;
} else {
newHikeMonth = false;
}
hikeLevel = getHikeLevel(hikeName);
hikenameShort = getHikenameShort(hikeName);
hikeDate = events[eventRow][0];
hikeDay = weekDaynames[hikeDate.getDay()];
hikeData.push(hikeDay);
hikeData.push(hikeDate.tolocaleDateString('en-US'));
hikeData.push(hikeName)
hikeData.push(hikenameShort);
hikeData.push(hikeLevel);
hikeData.push("");
hikeData.push("");
//hikeRowArray[0] = hikeRow;
//hikeData[hikeRow] = hikeRow;
console.log("GetTing Participants: " + hikeName)
while (events[eventRow][4] == hikeName){
if (events[eventRow][9] != "PaID") {
eventRow += 1;
conTinue;
}
hikeData.push(events[eventRow][6] + " " + events[eventRow][5]);
eventRow += 1;
participantnumber += 1;
}
numParticipants = participantnumber
for (var i = participantnumber+1; i < 30; i++){
hikeData.push("");
}
//Logger.log(hikeParticipants[participantnumber]);
hikeData.push(numParticipants < 15 ? "Yes" : "No");
hikeData.push(15 - numParticipants);
// That's all for that hike - go to next hike
participantnumber = 0;
eventRow += 1;
hikeData.push(hikeData);
hikescolumn.push(hikeData);
console.log("Going to next hike at eventRow:" + eventRow)
if (newHikeMonth) {
hikesDataBymonth.push(hikescolumn);
}
}
}
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的Google Apps 脚本(似乎)在循环中随机挂起(圆圈图标无限期运行)全部内容,希望文章能够帮你解决Google Apps 脚本(似乎)在循环中随机挂起(圆圈图标无限期运行)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。