-
Notifications
You must be signed in to change notification settings - Fork 446
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
Feature request: add option to warm-up country import cache #1514
Comments
Hi @eliasdorneles, Having said that, I'd like to request some clarification on this (multi-threading?) issue. It'd be ideal to have a PR (draft is okay) to understand the problem and assess the fix implementation approach. Thank you! |
Hello, Right, I understand, I will try to get a minimal example that shows the problem. The web application I mentioned (which I unfortunately cannot share the code as-is) is a FastAPI app, with endpoints defined as "sync" (using regular I will come back with more details later! |
Fixed by #1794 |
Hello,
Thanks for this library, nice work!
I'm using it in a web application that receives lots of requests, and recently had to debug an issue of thread contention caused by the
importlib.import_module
here:python-holidays/holidays/registry.py
Line 213 in 600ac69
The threads were getting stuck trying to acquire the import lock, the call stack (obtained with
py-spy
) looked like this:The fix for it was to call
country_holidays
in my code at import time for every country i care about, thus avoiding theimportlib.import_module
from being called from inside the request lifecycle as theentity
attribute will be already loaded.What do you think of adding an option to do that by default?
For example, something like:
The text was updated successfully, but these errors were encountered: