https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43787
--- Comment #3 from Andrew Fuerste-Henry <[email protected]> --- Created attachment 207896 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207896&action=edit Bug 43787: Reduce the size of the html rendered by addorderiso2709.pl via collapse TT filter The page for adding orders to a basket from a staged file has a fund dropdown for each record, and another for each item when MarcItemFieldsToOrder is used. Each dropdown lists every fund from every budget, including inactive ones that are only hidden by JavaScript. The template loops that build those options are deeply indented and nothing removes the whitespace, so each option carries hundreds of bytes of spaces and newlines. With about 1,000 funds and a file of 140 records and 281 items the page is 349 MB, 88% of it whitespace, and the Starman worker that renders it peaks at 4.3 GB of memory. Wrapping those blocks in a collapse filter from template toolkit cuts the page size down to 56 MB, with worker RAM usage dropping to 912 MB! Test Plan: 1) Create 1,000 funds in an inactive budget: INSERT INTO aqbudgetperiods ( budget_period_startdate, budget_period_enddate, budget_period_active, budget_period_description, budget_period_total ) VALUES ( '2020-01-01', '2020-12-31', 0, 'Old test budget', 0 ); INSERT INTO aqbudgets ( budget_period_id, budget_code, budget_name, budget_amount ) WITH RECURSIVE seq ( n ) AS ( SELECT 1 UNION ALL SELECT n + 1 FROM seq WHERE n < 1000 ) SELECT LAST_INSERT_ID(), CONCAT( 'OLD', n ), CONCAT( 'Old test fund number ', n ), 1000 FROM seq; 2) Set MarcItemFieldsToOrder to: homebranch: 952$a holdingbranch: 952$b itype: 952$y 3) Download the attached order_test.mrc ( 140 records with 281 items ) 4) Create a basket, choose Add to basket > From a new file, stage order_test.mrc 5) Click "Add staged files to basket" 6) Note the page is about 350 MB in your browser's network tab and takes a long time to load 7) Apply this patch 8) Restart all the things! 9) Reload the page, note it is now about 55 MB! Signed-off-by: Barbara Johnson <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
