You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just to add, continuously rescheduling the same task using a setTimeout is (IMO) a bad idea for embedded things. What happens if something you didn't expect causes an exception? The whole thing will stop. It doesn't have to be network-related at all.

    IMO something like this is a lot more straightforward.

    var inProgress = false;
    function doStuff() {
      if (inProgress) console.log("Last transaction failed...");
      inProgress = true;
      http.get(..., function() {
        inProgress = false;
      });
    }
    setInterval(doStuff, 60000);
    

    Although as you noted earlier it only really works if the period is greater than the socket timeout.

    Also, the socket error printed to the console will almost certainly have come from idle processing, and won't affect the execution of any code. It just means your handler won't get called.

About

Avatar for Gordon @Gordon started