JavaScript From a cloud function: how to call JavaScript function that is recursive? trigger dataflow from cloud function,send email from cloud function,

Is this recursion coded wrong or is it just that console.log() is not always executed even if the recursion is executed?  

function testrecur(s) {
    console.log("begin testrecur=" + s);
    s++;
    if (s < 10) {
        testrecur(s);
    } else {
        return s;
    }
}
Parse.Cloud.define("testrecursion", function(request, response) {
    Parse.Promise.as().then(function() {
        return testrecur(0);
    }).then(function(Result) {
        response.success(Result);
    }, function(error) {
        response.error(error);
    });
});

Executing testrecursion returns no errors in console.

The info console log shows

I2015-10-10T08:55:17.308Z]begin testrecur=0
I2015-10-10T08:55:17.309Z]begin testrecur=1
I2015-10-10T08:55:17.315Z]begin testrecur=7
I2015-10-10T08:55:17.316Z]begin testrecur=8

Executing testrecursion again shows this in the info console log.

I2015-10-10T08:19:15.970Z]begin testrecur=0
I2015-10-10T08:19:15.971Z]begin testrecur=1
I2015-10-10T08:19:15.972Z]begin testrecur=2
I2015-10-10T08:19:15.973Z]begin testrecur=3
I2015-10-10T08:19:15.974Z]begin testrecur=4
I2015-10-10T08:19:15.975Z]begin testrecur=5
I2015-10-10T08:19:15.978Z]begin testrecur=8

Executing testrecursion the 3rd time shows this in the info console log.

I2015-10-10T08:22:14.729Z]begin testrecur=2
I2015-10-10T08:22:14.731Z]begin testrecur=4
I2015-10-10T08:22:14.732Z]begin testrecur=5
I2015-10-10T08:22:14.733Z]begin testrecur=6
I2015-10-10T08:22:14.734Z]begin testrecur=7

After testing this dozens of times, the recursive steps appear to be called sporadically. The output seems to be random. The expected output is

I2015-10-10T08:19:15.970Z]begin testrecur=0
I2015-10-10T08:19:15.971Z]begin testrecur=1
I2015-10-10T08:19:15.972Z]begin testrecur=2
I2015-10-10T08:19:15.973Z]begin testrecur=3
I2015-10-10T08:19:15.974Z]begin testrecur=4
I2015-10-10T08:19:15.975Z]begin testrecur=5
I2015-10-10T08:19:15.975Z]begin testrecur=6
I2015-10-10T08:19:15.975Z]begin testrecur=7
I2015-10-10T08:19:15.975Z]begin testrecur=8
I2015-10-10T08:19:15.975Z]begin testrecur=9

Does this look like the recursion is happening correctly, and it's just that the console log is not logging all the messages?

I'm trying to implement what Hector Ramos mentioned in https://www.parse.com/questions/error-too-many-recursive-calls-into-cloud-code You can use recursion, you just can't recursively call Cloud Functions since that Cloud Function request will execute on a different thread. Use regular JavaScript functions, initiated from a Cloud Function, instead. - H├ęctor Ramos about 2 years ago

Answer:1

Currently screensharing on localhost in firefox throws the following error: The request is not allowed by the user agent or the platform in the current context.. Here's my code: navigator....

Currently screensharing on localhost in firefox throws the following error: The request is not allowed by the user agent or the platform in the current context.. Here's my code: navigator....

Trying to migrate from react 15.6.1 to 16.0.0. I have updated my package.json, to "react": "16.0.0","react-dom": "16.0.0", (only things I changed so far), and from what I've understood from the ...

Trying to migrate from react 15.6.1 to 16.0.0. I have updated my package.json, to "react": "16.0.0","react-dom": "16.0.0", (only things I changed so far), and from what I've understood from the ...

Here is my initial code: Where I can add textbox by clicking the add button. <script type="text/javascript"> function addRow(tableID) { var table = document.getElementById(tableID); ...

Here is my initial code: Where I can add textbox by clicking the add button. <script type="text/javascript"> function addRow(tableID) { var table = document.getElementById(tableID); ...

  1. total value of sales crossword clue
  2. total value of assets
  3. total value of us stock market
  4. total value of ownership
  5. total value of a number
  6. total value of bitcoin
  7. total value in zerodha
  8. total value of sales
  9. total value of amazon
  10. total value of apple
  11. total value of stock market
  12. total value of tata group
  13. total value of pi
  14. total value in maths
  15. total value of s&p 500
  16. total value of indian economy
  17. total value of india
  18. total value of sales crossword
  19. total value of us economy
  20. total value of world economy

I have an immutable object as my state in a redux reducer, and am trying to add/updates objects to a list. Here's my reducer: import { fromJS } from 'immutable' const initialState = fromJS({ ...

I have an immutable object as my state in a redux reducer, and am trying to add/updates objects to a list. Here's my reducer: import { fromJS } from 'immutable' const initialState = fromJS({ ...

  1. immutable redux push