2
我試圖保存Cloud代碼函數中的對象集合。Parse.com Cloud代碼 - saveAll請求超時
30-40個對象後,我得到一個超時錯誤。我的代碼如下所示:
Parse.Cloud.define("saveInBackground", function (request, response) {
console.log("saveInBackground begin");
var objectsToSave = [];
for (var i = request.params.collectionToSave.length - 1; i >= 0; i--) {
objectsToSave.push(new LikedObject(request.params.collectionToSave[i]));
};
Parse.Object.saveAll(objectsToSave, {
success: function(list) {
// All the objects were saved.
if (response) {
response.success(list);
};
console.log("saveInBackground success");
},
error: function(model, error) {
// An error occurred while saving one of the objects.
if (response) {
response.error(error);
};
console.log("saveInBackground error: " + error.message);
}
});
console.log("saveInBackground end");
});
我可以做其他事情來保存一堆對象嗎?