parse.com后台作业使用云代码功能触发超时

时间:2014-04-28 20:16:20

标签: parse-platform

我编写了一个名为approveDish的云代码函数,当我从客户端按钮直接调用该函数时,该函数在Parse.com设置的超时限制内工作。

但是,我需要将一些旧的数据库记录迁移到此,并且想知道为什么当我在查询中返回大于3个结果的后台作业时,我会在该云代码函数中获得超时。在我们正在认真对待事情的时候,这不应该在后台工作中没有超时吗?

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

Parse.Cloud.useMasterKey();

var Dishes = Parse.Object.extend("Dishes");
var query = new Parse.Query(Dishes);
query.notEqualTo("approved", true);
//dishes.equalTo("user", "JQd58QhOCO");
query.limit(1);
query.find().then(function(results) {
// Create a trivial resolved promise as a base case.
                var promise = Parse.Promise.as();
                _.each(results, function(result) {
                     // For each item, extend the promise with a function to delete it.
                         promise = promise.then(function() {
                            // Return a promise that will be  resolved when the delete is finished.
                            return Parse.Cloud.run("approveDish",     {dishID: result.id});
                        });
                        });
                return promise;

}).then(function() {

            status.success();

});

});

0 个答案:

没有答案