• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

API requests stop firing after a couple hours for custom module

Scheduled Pinned Locked Moved Troubleshooting
7 Posts 4 Posters 2.0k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    NateDee
    last edited by Feb 17, 2018, 4:22 PM

    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!

    1 Reply Last reply Reply Quote 0
    • M Offline
      mochman Module Developer
      last edited by Feb 18, 2018, 3:19 AM

      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.

      1 Reply Last reply Reply Quote 0
      • N Offline
        NateDee
        last edited by Feb 24, 2018, 5:47 AM

        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.

        M 1 Reply Last reply Feb 24, 2018, 1:54 PM Reply Quote 0
        • P Offline
          pinsdorf Module Developer
          last edited by Feb 24, 2018, 8:09 AM

          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.

          1 Reply Last reply Reply Quote 0
          • M Offline
            mochman Module Developer @NateDee
            last edited by Feb 24, 2018, 1:54 PM

            @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?

            1 Reply Last reply Reply Quote 0
            • N Offline
              NateDee
              last edited by Feb 24, 2018, 4:05 PM

              @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.

              1 Reply Last reply Reply Quote 0
              • C Offline
                cowboysdude Module Developer
                last edited by Feb 25, 2018, 12:31 AM

                You could also do a console.log to see if you’re getting regular outputs after your request…

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  1/7
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy