Read the statement by Michael Teeuw here.
MMM-MealieMenu Fetch Error
-
Hello. I have the MMM-MealieMenu module configured and working on an RPi5 but I run into a recurring issue where it will display a fetch error periodically.
I’m not sure what causes it to be briefly unable to get the meal plan but the “bug” in my mind is that once the module hits that error it will just stop trying to refreshing the data forever, until I restart the Magic Mirror service. Once I restart the service it will get the meal plan and be happy for a few more days.
I’m wondering if someone with more coding skills than myself can suggest a tweak to (presumably) the node_helper.js file so that it will allow the module to either try again at the next configured refresh cycle, or wait a period of time and retry repeatedly. Lines 120 to 126 seem to be the code block that deals with this particular error.
I’m not sure where I might find log information to troubleshoot why the fetch error occurs in the first place but it appears to just be temporary as the meal planner remains accessible at it’s URL when using a browser, despite the error on screen. It’s all hosted on the Pi using the docker image.
-
@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… -
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
-
@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…
-
@WallysWellies actually, the unrecoverable config errors are handled in a different place…
so, just copy that one line before the sendSocketNotification for error
-
@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.
-
@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!
-
@WallysWellies yes, correct
-
@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.
-
-
@WallysWellies remember that this is not an official change, so it could be lost.if you refresh the module