Read the statement by Michael Teeuw here.
API requests stop firing after a couple hours for custom module
-
Hi All,
Just got my mirror up and running, I am still working on my custom MMM-CTA module, a module for Chicago public transit. My issue is after a couple of hours of flawless running, the module stops sending API requests. I have a scheduleUpdate() function handling the repeating requests.
You can view my code here: https://github.com/NateDee/MMM-CTA
It’s still a work in progress but, has anybody had similar issues? No errors in my console logs, the requests just stop firing after about 2 hours. I’m a bioinformatician so a bit of a jack of all trades, master of none, and somewhat new to JavaScript.
Thanks for any help!
-
I have a similar issue with forecast-io. Sometimes it updates for days, sometimes it stops updating after an hour or so. I wish I could help fix your problem, but the only thing I did was add a small piece of text that shows when it was last updated so I can restart the mirror.
-
Mochman are you using a setTimeout() or setInterval() function to schedule your requests? I was using a setTimeout() and just switched over to setInterval(), I will let you know how it goes. Mine pretty much always cuts out within a few hours.
From the javascript docs, setTimeout() calls the function once, and I rely on a call to a scheduleUpdate() function to call setTimeout() after each successful request. If any hiccup in the request, setTimeout() won’t be called again. However, setInterval() calls repeatedly unless told to stop, so no dependency on any successful runs.
I’ll update you if that does the trick for me.
-
First thing I’d try is logging HTTP request and response into a file to collect some more details to reason on. Don’t forget to log timestamps and all headers.
Having said that, I think @NateDee’s explanation makes a lot of sense to me.
-
@NateDee I tried the same thing. The weird thing is that all the other modules update normally, just the one weather one. Nay luck with your issue?
-
@mochman after 10 hours it’s still running and updating! I think that did the trick! It would always freeze during the overnight hours, I’m guessing I was having some hiccup for when no buses and trains were running. Do you have a thread open for your issue?
@pinsdorf I had logs running, including logging json respones, but I never saw any errors the requests would just stop.
-
You could also do a console.log to see if you’re getting regular outputs after your request…