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.

    MMM-MealieMenu Fetch Error

    Scheduled Pinned Locked Moved Solved Troubleshooting
    30 Posts 3 Posters 5.4k 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.
    • S Offline
      sdetweil @WallysWellies
      last edited by

      @WallysWellies I am a mealie user too.

      code looks good. will have to setup and test.

      it does get the data frequently
      60 seconds by default…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      W 1 Reply Last reply Reply Quote 0
      • W Offline
        WallysWellies @sdetweil
        last edited by

        @sdetweil

        Thanks Sam. Any pointers would be good. It’s a fairly minor thing but it just seems a bit odd that after a single fetch error it just gives up forever (until restarted).

        I’ve discovered the pm2 log so I will try and remember to have a look at that next time it throws the error.

        I changed the config to update once every hour when I initially set it up:

        updateInterval: 60 * 60
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @WallysWellies
          last edited by

          @WallysWellies ok… I’ll watch it running here at 15 min updates…

          well, I found it…

          in the node helper he sets a flag, to say request is active

          if the flag is set when the request comes from the module side
          he just returns… does nothing.

          on error he does not clear the flag
          (bad network, host, authorization… places where there is no recovery
          those make sense…)

                .catch((error) => {   //<--- had and error here ... 
                  this.sendSocketNotification("MEALIE_ERROR", {
                    error: "FETCH_ERROR",
                    details: error,
                    identifier: config.identifier
                  });
                })
                .finally(() => {
                  this.outstandingRequest = false;   // < --- only clears flag on success
                });
          

          one could examine the error and reset if its a potentially recoverable error…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @sdetweil
            last edited by sdetweil

            @WallysWellies actually, the unrecoverable config errors are handled in a different place…

            so, just copy that one line before the sendSocketNotification for error

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            W 2 Replies Last reply Reply Quote 0
            • W Offline
              WallysWellies @sdetweil
              last edited by

              @sdetweil Thank you for your advice and apologies for the delayed response - I need to enable email notifications or something…

              I will try your suggestion. Much appreciated.

              1 Reply Last reply Reply Quote 0
              • W Offline
                WallysWellies @sdetweil
                last edited by

                @sdetweil I’m looking at the node_helper.js file and reading your comments and I’m a little unsure what you are suggesting.

                Are you saying I could edit this code block:

                .catch((error) => {
                        this.sendSocketNotification("MEALIE_ERROR", {
                          error: "FETCH_ERROR",
                          details: error,
                          identifier: config.identifier
                        });
                      })
                

                to this:

                .catch((error) => {
                        this.outstandingRequest = false; 
                        this.sendSocketNotification("MEALIE_ERROR", {
                          error: "FETCH_ERROR",
                          details: error,
                          identifier: config.identifier
                        });
                      })
                

                ?

                Sorry, I can fumble my way around code but I’m far from a programmer!

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @WallysWellies
                  last edited by

                  @WallysWellies yes, correct

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  W 1 Reply Last reply Reply Quote 0
                  • W Offline
                    WallysWellies @sdetweil
                    last edited by

                    @sdetweil Done!

                    I shall try and remember to report back if it seems to have worked - if I do not then we can assume I am a happy customer.

                    Cheers for your time.

                    S 1 Reply Last reply Reply Quote 0
                    • W WallysWellies has marked this topic as solved on
                    • S Offline
                      sdetweil @WallysWellies
                      last edited by

                      @WallysWellies remember that this is not an official change, so it could be lost.if you refresh the module

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • zanixZ Offline
                        zanix
                        last edited by

                        @sdetweil said in MMM-MealieMenu Fetch Error:

                        @WallysWellies I am a mealie user too.

                        code looks good. will have to setup and test.

                        it does get the data frequently
                        60 seconds by default…

                        I should probably set the default to something higher. I had it set to 60 seconds while I was developing it.

                        @sdetweil said in MMM-MealieMenu Fetch Error:

                        @WallysWellies ok… I’ll watch it running here at 15 min updates…

                        well, I found it…

                        in the node helper he sets a flag, to say request is active

                        if the flag is set when the request comes from the module side
                        he just returns… does nothing.

                        on error he does not clear the flag
                        (bad network, host, authorization… places where there is no recovery
                        those make sense…)

                              .catch((error) => {   //<--- had and error here ... 
                                this.sendSocketNotification("MEALIE_ERROR", {
                                  error: "FETCH_ERROR",
                                  details: error,
                                  identifier: config.identifier
                                });
                              })
                              .finally(() => {
                                this.outstandingRequest = false;   // < --- only clears flag on success
                              });
                        

                        one could examine the error and reset if its a potentially recoverable error…

                        I thought finally() runs even after a catch(), dangit.

                        @WallysWellies said in MMM-MealieMenu Fetch Error:

                        @sdetweil I’m looking at the node_helper.js file and reading your comments and I’m a little unsure what you are suggesting.

                        Are you saying I could edit this code block:

                        .catch((error) => {
                                this.sendSocketNotification("MEALIE_ERROR", {
                                  error: "FETCH_ERROR",
                                  details: error,
                                  identifier: config.identifier
                                });
                              })
                        

                        to this:

                        .catch((error) => {
                                this.outstandingRequest = false; 
                                this.sendSocketNotification("MEALIE_ERROR", {
                                  error: "FETCH_ERROR",
                                  details: error,
                                  identifier: config.identifier
                                });
                              })
                        

                        ?

                        Sorry, I can fumble my way around code but I’m far from a programmer!

                        I will get this fix added and set the default updateInterval to something a bit more sane soon. Thanks to all for troubleshooting!

                        W 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 1 / 3
                        • 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