Lazy-import similar_talks to fix Gunicorn worker OOM on startup#4569
Lazy-import similar_talks to fix Gunicorn worker OOM on startup#4569
Conversation
Move the import of reviews.similar_talks into the admin view that uses it. The module imports heavy ML libraries (sentence-transformers, bertopic, torch) which caused Gunicorn workers to OOM/timeout during boot, preventing deployment.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
SummaryMoves the import of heavy ML libraries (sentence-transformers, bertopic, torch) from module-level to function-level in Issues FoundTesting - Test mocks need updatingThe lazy import breaks existing tests. Currently, tests mock Affected tests in
Fix needed: Change all mock paths from:
To:
This will patch the functions at their source module instead of where they were previously imported. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4569 +/- ##
=======================================
Coverage 92.50% 92.50%
=======================================
Files 355 355
Lines 10658 10658
Branches 812 812
=======================================
Hits 9859 9859
Misses 687 687
Partials 112 112 🚀 New features to boost your workflow:
|
Summary
reviews.similar_talksfrom the top ofadmin.pyinto the view function that uses itTest plan