Skip to content

refactor: optimize album color scheme generation and caching#2017

Merged
theovilardo merged 1 commit into
masterfrom
fix/album-color-reset
May 16, 2026
Merged

refactor: optimize album color scheme generation and caching#2017
theovilardo merged 1 commit into
masterfrom
fix/album-color-reset

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

Improves the efficiency of ThemeStateHolder by allowing multiple subscribers to wait for the same color scheme generation request. Also increases the LRU cache capacity to improve performance when navigating through large libraries.

  • Replaced the simple pendingAlbumColorSchemeRequests set with a synchronized pendingAlbumColorSchemeTargets map to track and update multiple MutableStateFlow instances for a single URI.
  • Increased individualAlbumColorSchemes LRU cache size from 30 to 96 entries.
  • Added validation to handle blank URI strings, returning a static emptyAlbumColorScheme flow.
  • Improved thread safety by using a dedicated lock for pending request operations and updated onTrimMemory accordingly.
  • Cleaned up unused ConcurrentHashMap import.

Improves the efficiency of `ThemeStateHolder` by allowing multiple subscribers to wait for the same color scheme generation request. Also increases the LRU cache capacity to improve performance when navigating through large libraries.

- Replaced the simple `pendingAlbumColorSchemeRequests` set with a synchronized `pendingAlbumColorSchemeTargets` map to track and update multiple `MutableStateFlow` instances for a single URI.
- Increased `individualAlbumColorSchemes` LRU cache size from 30 to 96 entries.
- Added validation to handle blank URI strings, returning a static `emptyAlbumColorScheme` flow.
- Improved thread safety by using a dedicated lock for pending request operations and updated `onTrimMemory` accordingly.
- Cleaned up unused `ConcurrentHashMap` import.
@theovilardo theovilardo merged commit 39afb88 into master May 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant