fix: unique process keys per instance to prevent collision on multi-monitor setups#7
Open
navidagz wants to merge 1 commit into
Open
Conversation
Author
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.
Description
Problem
When running two instances of the plugin (one per monitor) and calling
dms ipc call plugins reload pkgUpdate,one instance would get stuck showing "Checking for updates" indefinitely.
The cause:
Proc.runCommanduses a string key to identify and deduplicate managed processes globally across theshell. All three keys (
pkgUpdate.dnf,pkgUpdate.flatpakMeta,pkgUpdate.flatpakUpdates) were hardcoded, so whenthe second instance called
checkUpdates(), DMS saw those keys already in use by the first instance and skippedspawning new processes. The callbacks never fired, leaving
dnfCheckingandflatpakCheckingstuck at true.Fix
Added a
_procNsproperty that generates a random per-instance prefix at construction time usingMath.random().toString(36).slice(2). AllProc.runCommandkeys are now namespaced under this prefix, making themunique per instance regardless of how many bars are running.
Verification
Confirmed two instances produce distinct keys on reload: