-
-
Notifications
You must be signed in to change notification settings - Fork 441
refactor: make cache_manager thread safe #1039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: make cache_manager thread safe #1039
Conversation
CyanVoxel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening this PR, the wonky threading is an internal issue of the current cache system that I've been wanting to have fixed since it was introduced.
However I am currently unable to review this further as it crashes when opening most libraries for me (macOS 15.5):
(There may be multiple issues occurring here)
2025-08-19 13:54:06 [info ] [FFmpeg] Using FFprobe location: ffprobe (Found)
2025-08-19 13:54:06 [info ] [FFmpeg] Using FFmpeg location: ffmpeg (Found)
2025-08-19 13:54:06 [info ] [ResourceManager] Resources Registered: count=33
2025-08-19 13:54:06 [info ] [Settings] Global Settings File Path not specified, using default
2025-08-19 13:54:06 [info ] [Settings] Reading Global Settings File path=PosixPath('/Users/cyanvoxel/.config/TagStudio/settings.toml')
2025-08-19 13:54:06 [info ] [Cache] Cache File not specified, using default one filename=/Users/cyanvoxel/.config/TagStudio/TagStudio.ini
2025-08-19 13:54:08 [error ] [Errno 20] Not a directory: '/Users/cyanvoxel/Local Files/Projects/TagStudio Project/Test Libraries/Example 2/.TagStudio/thumbs/.DS_Store'
Traceback (most recent call last):
File "/Users/cyanvoxel/Local Files/Dev/TagStudio/src/tagstudio/main.py", line 64, in main
driver.start()
File "/Users/cyanvoxel/Local Files/Dev/TagStudio/src/tagstudio/qt/ts_qt.py", line 556, in start
self.open_library(path_result.library_path)
File "/Users/cyanvoxel/Local Files/Dev/TagStudio/src/tagstudio/qt/ts_qt.py", line 1672, in open_library
defaultValue=self.lib.cache_manager.max_size,
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Library' object has no attribute 'cache_manager'
2025-08-19 13:54:08 [info ]
TagStudio Frontend (Qt) Crashed! Press Enter to Continue...
I am also able to "jam up" the cache deletion by tossing in a random file into the thumbs folder, causing a traceback. From what I can tell you're choosing to delete the entire thumbs folder now instead of each of the folders inside it, which is contributing to this problem.
|
This should now work with random files in the cache folder. As well as cache folders being deleted outside of tagstudio. |
CyanVoxel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything seems to be functional now, thank you for your work on this! I've just resolved the merge conflicts with #1057 and will get this merged.
Summary
Fixes errors from multiple render threads adding/removing cache folders.
Fixes
register_existing_foldersonly calculating the size for the last folder in the cache.Tasks Completed