-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixes problem with notices cache #14229
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
Conversation
except Exception: | ||
try: | ||
# Remove the notices cache file if we encounter an exception | ||
cache.clear_cache() |
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.
I'm still not sure this is the right approach to use. This means that every time an error is encountered, the cache files get removed and then conda checks again for these notices which is probably not the desired behavior 😭.
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.
ah good point, what kind of exceptions could we expect here?
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.
Any type of error because if any error occurs at all during the command that is decorated with this decorator, we don't want the notices to be shown. At that point, there's so much output on the screen that it would be too much information presented.
CodSpeed Instrumentation Performance ReportMerging #14229 will not alter performanceComparing Summary
|
conda/notices/cache.py
Outdated
cache_dir = get_notices_cache_dir() | ||
cache_file = cache_dir.joinpath(NOTICES_CACHE_FN) | ||
|
||
if not cache_file.is_file(): | ||
with open(cache_file, "w") as fp: | ||
fp.write("") | ||
|
||
current_time = time.time() | ||
create_time = current_time - NOTICES_DECORATOR_DISPLAY_INTERVAL | ||
os.utime(cache_file, (create_time, create_time)) |
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.
This seems really odd. Can we write the timestamp to a file that has true filesystem timestamps (i.e. the current time?) Recommend using mtime only as the timestamp conda cares about.
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.
I've done this in f0d9245
(#14229)
Co-authored-by: Ken Odegard <kodegard@anaconda.com>
Co-authored-by: Daniel Holth <dholth@anaconda.com>
…ile setting modification time to past for immediate notice display
…st_main_notices.py`
…ing fixture settings for channel notices
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.
I'm feeling good about the changes that @jezdez has made since I started working on this. I think it's ready to be merged.
…ronment variable for channel notices directly
Description
Fixes: #14072
Checklist - did you ...
news
directory (using the template) for the next release's release notes?