callFunctionInBackground from iOS keeps spinning wheel
I am using Ubuntu with parse-server 2.1.6 with pm2 and environment vars... everything works great but I noticed that when I call cloud code function from iOS the spinning wheel in status bar in iPhone keeps spinning that it is making some network request, but debugger showed it doesnt send or receive any data... it is just spinning and after some time (around one minute) it prints in console in xcode this errors
2016-03-19 11:57:14.027 MyApp[16540:6959618] [Error]: The request timed out. (Code: 100, Version: 1.12.0)
2016-03-19 11:57:14.031 MyApp[16540:6959618] [Error]: Network connection failed. Making attempt 1 after sleeping for 1.005982 seconds.
It ends with Making attempt 5 but the wheel is spinning at least for 5 minutes..., this spinning wheel also appears after I call the same function for second time ( I use this function for rating posts and it is triggered everytime user hits the button for rating)
//caling the function from iOS with Swift
PFCloud.callFunctionInBackground("updateUserScore", withParameters: ["targetUser" : authorOfTheRatedObject.objectId!, "value" : value * 2])
// cloud code
Parse.Cloud.define("updateUserScore", function(request, response) {
var targetUser = request.params.targetUser;
var value = request.params.value;
var query = new Parse.Query(Parse.User);
query.equalTo("objectId", targetUser);
query.first({ useMasterKey: true }).then((result) => {
result.increment("score", value);
result.save(null, { useMasterKey: true });
response.success();
}, (error) => {
console.log('Error 1487 - query failed', error);
response.error(error);
});
});
I found out the main problem, In the cloud code query I was trying to get user with ID that was not in the database, however it never went to the Error, it kept spinning the wheel in ios and disabled all the networking of the app for approximately 5 minutes, so maybe it is different error than I expected...
Closing as this is not an issue in Parse Server.