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.2k 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.
    • mochmanM Offline
      mochman Module Developer
      last edited by

      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

        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.

        mochmanM 1 Reply Last reply Reply Quote 0
        • P Offline
          pinsdorf Module Developer
          last edited by

          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
          • mochmanM Offline
            mochman Module Developer @NateDee
            last edited by

            @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

              @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
              • cowboysdudeC Offline
                cowboysdude Module Developer
                last edited by

                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
                • First post
                  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