Node.js 是否有处理错误的变通方法“;错误:超过4个截止日期:超过截止日期”;云中函数
我正在使用云函数的批写入功能向Firestore进行写入。 此时,显示错误:超过4个截止日期:超过截止日期,书写中断 在看了这个问题之后,我知道错误的内容达到了写作限额,但我不知道如何处理限额。如果你知道怎么解决,请告诉我 这是我的密码Node.js 是否有处理错误的变通方法“;错误:超过4个截止日期:超过截止日期”;云中函数,node.js,firebase,google-cloud-firestore,google-cloud-functions,Node.js,Firebase,Google Cloud Firestore,Google Cloud Functions,我正在使用云函数的批写入功能向Firestore进行写入。 此时,显示错误:超过4个截止日期:超过截止日期,书写中断 在看了这个问题之后,我知道错误的内容达到了写作限额,但我不知道如何处理限额。如果你知道怎么解决,请告诉我 这是我的密码 exports.batchTest = functions.region('asia-northeast1').pubsub.schedule('every 60 minutes').onRun(async (snapshot, context) => {
exports.batchTest = functions.region('asia-northeast1').pubsub.schedule('every 60 minutes').onRun(async (snapshot, context) => {
let db = admin.firestore();
// Get a new write batch
let batch = db.batch();
const userRef = db.collection('user');
const userQs = await userRef.get();
userQs.forEach(userDocs => {
let userId = userDocs.id;
let likeRef = db.collection('like').doc(userId).collection('like').get().then(docs => {
if (docs.exists) {
const subLikeRef = db.collection('like').doc(userId).collection('like').doc(docs.id);
batch.delete(subLikeRef)
.then(function () {
console.log("success");
return true;
})
.catch(function (error) {
console.error("Error", error);
return true;
});
}
return null;
});
});
// Commit the batch
return batch.commit().then(function () {
// ...
return null;
});
}
);
此错误与您发出的请求花费的时间太长有关 为了避免这种情况,您可以修改逻辑以在每次触发函数时写入一小批数据,也可以尝试增加超时值
您可以查看并增加超时值。此错误与您发出的请求耗时过长有关 为了避免这种情况,您可以修改逻辑以在每次触发函数时写入一小批数据,也可以尝试增加超时值
您可以查看并增加超时值。这个问题帮助了我-确保等待异步调用这个问题帮助了我-确保等待异步调用我收到了这个问题,我没有使用firebase函数。我将AWS Lambda与AWS SQS一起使用。我添加了队列以在发生此错误时处理重试。但我无法重现这个问题。我将10000条记录写入数据库,并以毫秒为间隔写入不同的集合/文档,但没有发现问题。正在编写的文档最多只有几行文本。我收到了这个问题,我没有使用firebase函数。我将AWS Lambda与AWS SQS一起使用。我添加了队列以在发生此错误时处理重试。但我无法重现这个问题。我将10000条记录写入数据库,并以毫秒为间隔写入不同的集合/文档,但没有发现问题。正在编写的文档最多只有几行文本。