Cache friendly name by UDID rather than globally#96
Merged
grahamgilbert merged 2 commits intosalopensource:mainfrom Aug 4, 2021
Merged
Cache friendly name by UDID rather than globally#96grahamgilbert merged 2 commits intosalopensource:mainfrom
grahamgilbert merged 2 commits intosalopensource:mainfrom
Conversation
Create a directory for caching machine friendly name, within that store name in <UDID>.txt file. Cleans out any file not for the current UDID. This addresses the situation where the global cache file is migrated via Migration Assistant and Sal reports the old machine friendly name.
| for cache_file in MODEL_PATH.iterdir(): | ||
| # clean up any other files in dir | ||
| if cache_file != UDID_CACHE_PATH: | ||
| cache_file.unlink() |
Member
There was a problem hiding this comment.
We should probably handle failing to remove the file for whatever reason
Contributor
Author
There was a problem hiding this comment.
Good point, no reason to kill the whole thing for something that is just housekeeping. I added
# clean up any other files in dir
if cache_file != UDID_CACHE_PATH:
try:
cache_file.unlink()
except:
pass
Contributor
Author
There was a problem hiding this comment.
Just wanted to follow up and see if you think this is a good way to handle failure to remove that file.
Use a try/except to avoid killing the whole process if an unused cache file can't be removed
grahamgilbert
approved these changes
Aug 4, 2021
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.
Create a directory for caching machine friendly name, within that store name in .txt file. Cleans out any file not for the current UDID.
This addresses the situation where the global cache file is migrated via Migration Assistant and Sal reports the old machine friendly name.