Admin loads associations on-demand, not immediately#928
Open
rgalanakis wants to merge 25 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #928 +/- ##
==========================================
- Coverage 99.82% 99.79% -0.04%
==========================================
Files 750 755 +5
Lines 37253 37818 +565
==========================================
+ Hits 37189 37740 +551
- Misses 64 78 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was a beast, as these things often go, but we need this for future pagination, and we need eager loading or things break for some reason due to tactical eager loading and large association warning.
Add two plugins to help with association loading performance. - large association warning: warn when associations over a certain size are loaded. Prevents unexpectedly blowing out memory. - efficient each: Allows 1) reusing a loaded association array, 2) streaming a not-loaded association from the database, and 3) storing a streamed association into the array if it's just one page. Move each_cursor_page to this plugin.
Loading combined_book_transactions could be very big. Use efficient_each to optimizing loading.
Reconfiguring the model replaced the DB which caused spec corruption.
* efficient-admin-prep: Fix issues with database corruption Ledger: Use efficient_each Add useDebugEffect to debug things on load. Add association loading performance plugins Vendor: Add discounted_rates association Card: Add originated_funding_transactions dataset Turn combined_notes into an association
Reconfiguring the model replaced the DB which caused spec corruption.
* efficient-admin-prep: Fix issues with database corruption
…y on POST, improve formHelpers
* main: Fix issues with database corruption Ledger: Use efficient_each Add useDebugEffect to debug things on load. Add association loading performance plugins Vendor: Add discounted_rates association Card: Add originated_funding_transactions dataset Turn combined_notes into an association
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admin entities expose lists, rather than eagerly loading all data.
We had associations with thousands of rows; this would blow out memory in production very quickly.
Instead, just return the first handful of items as collections, and then the 'related' list can page in additional results.
Admin is much snappier and uses much less memory. It did require a pretty massive change, exposing resources as proper collections rather than just array properties.