Repository navigation
fix(updatenotification): apply all pending module updates - #4313
Merged
KristjanESPERANTO merged 2 commits intoOct 23, 2026
Merged
KristjanESPERANTO merged 2 commits into
KristjanESPERANTO merged 2 commits into
Conversation
Run pending updates one after another instead of stopping after the first one, release the update lock in a finally block, and restart once after all updates when updateAutorestart is enabled. Also show the done/error lines on the mirror (updates was an array with string keys), fix the MagicMirror check in applyCommand and drop the unhandled UPDATE_ERROR notification. Fixes MagicMirrorOrg#4311 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shorten the log line before the automatic restart, since nodeRestart() already logs "Restarting MagicMirror...". Rename the frontend spec to frontend_spec.js to avoid clashing with the git helper spec, and derive the module import from moduleDir. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
khassel
approved these changes
Oct 23, 2026
Collaborator
Yes, a pull request for the documentation would be great after this one has been merged. Please create the documentation pull request against |
KristjanESPERANTO
approved these changes
Oct 23, 2026
KristjanESPERANTO
left a comment
Collaborator
There was a problem hiding this comment.
Looks good to me. As far as I can tell, there’s no option to get the previous behavior, but that might be overengineering. If anyone needs the old behavior, we can always add an option later.
Thanks for the PR! 🙂
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4311
When several modules have a pending update and an
updatescommand, only the first one was updated. The others were skipped without any message, in that check and every later one, until MagicMirror was restarted. As discussed in the issue, all pending updates are now applied by default.Changes
update_helper.jsparse()runs the pending updates one after another, not throughPromise.allwith a lock that was never released.updatingnow only keeps two update runs from overlapping (e.g.SCAN_UPDATESwhile a run is still going) and is reset in afinallyblock.inProgressis reset in the same way.updateInterval. A restart tries it again.updateAutorestart: true, MagicMirror restarts once after all updates are done. Before, the restart was scheduled 3 s after the first successful update and could cut off a later update that was still running.applyCommand()gets the module name as a string but checkedisMagicMirror(module.module), which was alwaysundefined. It now checks the name.node_helper.jsUPDATE_STATUSfor modules that were updated or failed. It used to checkinProgress, which is now only true while an update runs.updatenotification.jsupdatesis now an object, not an array. It is filled with module names as keys, and Nunjucks loops over such an array as if it were empty. Because of this, the "Update done" / "Update error" lines were never shown.UPDATE_ERRORsocket notification. The node helper never handled it, and the error is already logged by the helper.Tests
update_helper_spec.js: new tests forparse(). They cover: all modules updated in order with no overlap; real commands run in several temporary module folders; modules without a command skipped; a failed update not stopping the others; modules found in later checks updated; no retry of updated or failed modules; no second run while one is in progress; the lock released when an update throws; exactly one restart after all updates; no restart when every update failed. Also tests forapplyCommand(). The old test "schedules node restart when autoRestart is enabled" now checks thatupdateProcess()itself no longer restarts.node_helper_spec.js:UPDATE_STATUSis sent only for updated or failed modules.frontend_spec.js: renders the realupdatenotification.njkwith Nunjucks and checks the done, error and restart lines, plus deduplication per module. These tests fail withupdates: [].parse()tests and all four template tests failed.node --run test:unit(527 tests) andnode --run test:lintpass.node --run test:spellingreports the same 55 findings asdevelop, none in the changed files.Also tested by hand with a
serveronlyinstance and three local module repos that each had one new upstream commit (git pull,false,git pull):updateAutorestart: true2 module(s) updated.followed byRestarting MagicMirror...Docs
With this change, the "one module per run" behavior no longer needs to be documented. The updatenotification docs could still say that updates run one after another and that
updateAutorestartrestarts once after all of them. I can open a PR in the documentation repo if that helps.🤖 Generated with Claude Code