Search code examples
parse-server

My Parse job seems to work repeat itseself over and over again


Write the server part of the app in Parse server, and the job keeps executing over and over again.

Here is the code:

var cloudRequest = {
  "U": "jjj",
  "T": "ssss",
  "D": "tttt"
};

Parse.Cloud.run('joinUTT', cloudRequest, {
  success: function(result) {
    console.log("Done with joinUTT");
  },

  error: function(error) {
    console.log("Error after joinUTT");
  }
});

Any idea how to make it run just once?

Thanks!


Solution

  • I ran into this problem before - really hard to track down! Here's what has helped me:

    1. In your Cloud Code make sure to explicitly call response.success() and response.error().
    2. If you have no results to return, still define your Cloud Code function with (request, response) and call response.success(""); It is key to include "".

    My guess is that in absence of explicit success/error Parse continues to retry until it gets one of these results.