Skip to content

Conversation

@jlu5
Copy link
Collaborator

@jlu5 jlu5 commented Sep 12, 2025

This allows newly installed 3rd party dependencies and pip-installed plugins to become visible without restarting the bot. Previously, ImportErrors would be cached if a module was not present when loading it for the first time.

Ref: https://docs.python.org/3/library/importlib.html#importlib.invalidate_caches

This allows newly installed 3rd party dependencies and pip-installed plugins to become visible without restarting the bot.
@progval
Copy link
Owner

progval commented Sep 12, 2025

Would it make sense perf-wise to add a short cooldown or not invalidating the cache while the bot is booting up?

@progval
Copy link
Owner

progval commented Sep 12, 2025

Actually it looks like this doesn't clear sys.modules (which makes sense), so this change should have a negligible impact.

@progval
Copy link
Owner

progval commented Sep 12, 2025

very nice, thanks!

@jlu5 jlu5 merged commit 1c2e00c into master Sep 12, 2025
11 of 18 checks passed
@jlu5 jlu5 deleted the invalidate-caches branch September 12, 2025 10:15
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.

3 participants