darickc / MMM-BackgroundSlideshow

MIT License
135 stars 78 forks source link

Fixed bug on distributed instance (serveronly and client modes #123

Closed angeldeejay closed 1 year ago

angeldeejay commented 1 year ago

When using MagicMirror server only/client only strategy as described in the official docs, restarting the server node leaves the client node "zombie" due the server isn't available to retrieve configuration from the client again.

The error log is:

...
[INFO]  BACKGROUNDSLIDESHOW_NEXT_IMAGE
[LOG]   undefined
[ERROR] Whoops! There was an uncaught exception...
[ERROR] TypeError: Cannot read properties of undefined (reading 'imagePaths')
    at Class.gatherImageList (/opt/magic_mirror/modules/MMM-BackgroundSlideshow/node_helper.js:112:32)
    at Class.getNextImage (/opt/magic_mirror/modules/MMM-BackgroundSlideshow/node_helper.js:146:12)
    at Class.socketNotificationReceived (/opt/magic_mirror/modules/MMM-BackgroundSlideshow/node_helper.js:299:12)
    at Socket.<anonymous> (/opt/magic_mirror/js/node_helper.js:109:11)
    at Socket.emit (node:events:513:28)
    at Socket.emitUntyped (/opt/magic_mirror/node_modules/socket.io/dist/typed-events.js:69:22)
    at /opt/magic_mirror/node_modules/socket.io/dist/socket.js:465:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
[ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
[ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
...

This problem can be solved asking for the configuration again to the client nodes when server node detects this.config as undefined