Skip to content

Cache friendly name by UDID rather than globally #96

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

Merged
merged 2 commits into from
Aug 4, 2021

Conversation

thehilll
Copy link
Contributor

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.

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably handle failing to remove the file for whatever reason

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 grahamgilbert merged commit 6dda3ee into salopensource:main Aug 4, 2021
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.

2 participants