Conversation
…nt singleton deadlock
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.
动机与背景 1. 远程播控与跨窗口链路不全:桌面挂件或外部进程通过
music-remote-command发送播控指令时,原实现要求音乐窗口必须预先存在,若窗口未开启则直接丢弃指令;且不支持定向曲目点播;music-renderer-ready)完成前被用户强行关闭,主进程的musicWindowPromise悬挂不释放,导致调用方永久超时,且后续再也无法重新拉起播放器,必须重启主程序。核心改动
在 modules/ipc/musicHandlers.js 中实施跨窗口遥控增强与生命周期熔断闭环:
跨窗口播控智能路由:
music-remote-command 接入曲目定向匹配支持(支持 { target } 对象或 play:曲名 前缀格式);
当音乐窗口离线时,自动拉起窗口(createOrFocusMusicWindow)并延迟安全派发指令,补齐桌面挂件与扩展的端到端播控闭环。
窗口生命周期早夭自愈熔断:
引入 isSettled 守卫与结算清理机制;
在 musicWindow.on('closed') 钩子中侦测初始化早夭行为,主动触发 rejectWindowCreation,毫秒级释放外部挂起的等待协程;
彻底重置 musicWindowPromise 单例与 pendingPlaybackForNewWindow 暂存缓存,确保强关后随时可以再次秒级唤醒;
在 handleMusicControl 中完善异常捕获,向分布式服务与插件返回显式失败状态,杜绝链路悬挂。
测试验证
极端点叉压测:点歌或远程唤醒后在零点几秒内手动关闭窗口,调用链 1.5 秒内当即捕获错误并优雅退出;
免重启再次唤醒:强关后无需重启应用,下一秒再度发起点歌或远程命令,播放器顺畅拉起并正常开播;
桌面挂件联动:验证桌面挂件切歌、点播指令可正常唤醒播放器。