2

我将 Google Apps 脚本作为 WebApp 发布,但有时使用该脚本的用户会遇到:

Service invoked too many times in a short time: gmail rateMax. Try Utilities.sleep(1000) between calls. (line XXX)

异常告诉我用 a 减慢它Utitlities.sleep(1000),但是在这样做之前我想知道最大速率到底是多少。我能找到的唯一文档是配额页面,但上面写着: GMail Read: 10000 / day 我的脚本距离 10000 次读取还很远。有人知道rateMax具体指的是什么吗?

更新:导致此问题的代码如下(通过 XHR 调用):

add = function(form) {
// [...]

messageId = (_ref = form.msgId) != null ? _ref : form.messageId;
if (!messageId || !(message = GmailApp.getMessageById(messageId))) {
  throw ErrorCodes.INVALID_MESSAGE_ID;
}

// [...]

thread = GmailApp.getThreadById(message.getThread().getId());
if (String(form.archive) === "true") {
  thread.moveToArchive();
}

// [...]

addLabel(LABEL_BASE, thread);
addLabel(LABEL_OUTBOX, thread);
};

getLabel = function(name, create) {
var _ref;
return (_ref = GmailApp.getUserLabelByName(name)) != null ? _ref : (create ? GmailApp.createLabel(name) : void 0);
};

addLabel = function(name, thread) {
var _ref;
if ((_ref = this.getLabel(name, true)) != null) {
  _ref.addToThread(thread);
}
};

// [...]表示从示例中删除的不调用 GMail API 的代码。

4

1 回答 1

0

你是在检查附件,还是在做其他事情?现在应该修复一个错误,该错误会在加载附件时触发此错误。

于 2012-11-19T03:54:18.597 回答