gpt4 book ai didi

javascript - 解析.com : cannot create more than 9 objects using cloud job

转载 作者:行者123 更新时间:2023-11-30 10:09:34 27 4
gpt4 key购买 nike

我有这样的 Cloud Job 代码:

Parse.Cloud.job("createMySpecialObjects", function(request, status) {

var MySpecialObject = Parse.Object.extend("MySpecialObject");

var count = 20 // 20 is greater than 9!

for (var i = 0; i < count; i++) {
var myObject = new MySpecialObject();
myObject.save();
}

status.success("Objects created successfully.");
});

结果我只创建了 9 个对象。

我想它每秒连接 30 个 API 调用。但也许其他人知道得更多?

最佳答案

下面的代码片段展示了如何使用 Parse.Object.saveAll 保存多个对象。

Parse.Cloud.job("createMySpecialObjects", function(request, status) {

var MySpecialObject = Parse.Object.extend("MySpecialObject");

var count = 20 // 20 is greater than 9!

var toSaves = [];
for (var i = 0; i < count; i++) {
var myObject = new MySpecialObject();
toSaves.push(myObject);
}

Parse.Object.saveAll(toSaves, {
success: function(saveList) {
status.success("Objects created successfully.");
},
error: function(error) {
status.error("Unable to save objects.")
}
}
});

关于javascript - 解析.com : cannot create more than 9 objects using cloud job,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27269253/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com