fix(newsfeed): prevent duplicate parse error callback when using pipeline#4083
Merged
khassel merged 1 commit intoMagicMirrorOrg:developfrom Apr 3, 2026
Merged
fix(newsfeed): prevent duplicate parse error callback when using pipeline#4083khassel merged 1 commit intoMagicMirrorOrg:developfrom
khassel merged 1 commit intoMagicMirrorOrg:developfrom
Conversation
khassel
approved these changes
Apr 3, 2026
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.
In PR #4072 GitHub Bot complained that
newsfeedfetcher.jsused the old.pipe()method to connect streams (HTTP body → iconv decoding → RSS parser)..pipe()has a weakness: errors in one stream are not automatically forwarded to downstream streams. An I/O or decoding error would silently disappear.Solution
Replaced
.pipe()withawait stream.promises.pipeline(). Thepipeline()API is designed to propagate errors correctly through the entire chain and to clean up all streams on failure. Errors now reliably land in thecatchblock and callfetchFailedCallbackexactly once. The redundantparser.on("error")handler was removed, as it would have caught the same error again and called the callback a second time.Why not the bot's suggested fix?
The GitHub Bot suggested the older callback-based
stream.pipeline(callback)variant:This has two drawbacks compared to my approach:
stream.promises.pipeline()withasync/awaitis the modern, more readable API.parser.on("error")handler and thecatchblock, which would not have fixed the double-callback problem.Related to #4073