Bug 32266 - Large amount of late orders slows the service
Summary: Large amount of late orders slows the service
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Emmi Takkinen
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-18 13:12 UTC by Emmi Takkinen
Modified: 2022-12-29 07:16 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 32266: Add new syspref DefaultLateOrderFilterDaysAgo (5.02 KB, patch)
2022-11-22 09:24 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 32266: Add new syspref DefaultLateOrderFilterDaysAgo (5.08 KB, patch)
2022-11-22 16:51 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug 32266: Add new syspref DefaultLateOrderFilterDaysAgo (5.13 KB, patch)
2022-12-16 18:38 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Emmi Takkinen 2022-11-18 13:12:15 UTC
Almost all our library consortiums have large amounts of late orders. Smallest amount is around 2000, but largest is over 25000. Even with batch of 2000 orders, lateorders.pl takes over 40 seconds to open. Handling larger batches eventually leads to a Proxy error. 

One (quite easy imo) way to speed up fetching late orders is to add a syspref to set default value for late order filter "Order date: [] days ago".
Comment 1 Emmi Takkinen 2022-11-22 09:24:47 UTC
Created attachment 144145 [details] [review]
Bug 32266: Add new syspref DefaultLateOrderFilterDaysAgo

Some libraries might have large amounts of late orders that
slow down opening the lateorders.pl. E.g. patch of 2000
orders takes about 40 seconds to open, larger patches lead
to a proxy error.

This patch adds new syspref DefaultLateOrderFilterDaysAgo.
With this libraries can control how many days old late orders
should be for them to show in late orders listing.

To test:
1. Open browsers console (F12) and from there Network tab.
2. Navigate to Acquisitions -> Late Orders.
=> Take a note from browsers console how long it takes to open late orders listing.
3. Apply this patch, update you database and restart your services if needed.
4. Set some value to syspref DefaultLateOrderFilterDaysAgo (999 is max).
5. Load Late orders page again.
=> Loading page should now be significantly faster.
=> Only orders which

Sponsored-by: Koha-Suomi Oy
Comment 2 Amit Gupta 2022-11-22 16:51:07 UTC
Created attachment 144165 [details] [review]
Bug 32266: Add new syspref DefaultLateOrderFilterDaysAgo

To test:
1. Open browsers console (F12) and from there Network tab.
2. Navigate to Acquisitions -> Late Orders.
=> Take a note from browsers console how long it takes to open late orders listing.
3. Apply this patch, update you database and restart your services if needed.
4. Set some value to syspref DefaultLateOrderFilterDaysAgo (999 is max).
5. Load Late orders page again.

Nice enhancement.
Comment 3 Kyle M Hall 2022-12-16 18:38:03 UTC
Created attachment 144699 [details] [review]
Bug 32266: Add new syspref DefaultLateOrderFilterDaysAgo

Some libraries might have large amounts of late orders that
slow down opening the lateorders.pl. E.g. patch of 2000
orders takes about 40 seconds to open, larger patches lead
to a proxy error.

This patch adds new syspref DefaultLateOrderFilterDaysAgo.
With this libraries can control how many days old late orders
should be for them to show in late orders listing.

To test:
1. Open browsers console (F12) and from there Network tab.
2. Navigate to Acquisitions -> Late Orders.
=> Take a note from browsers console how long it takes to open late orders listing.
3. Apply this patch, update you database and restart your services if needed.
4. Set some value to syspref DefaultLateOrderFilterDaysAgo (999 is max).
5. Load Late orders page again.
=> Loading page should now be significantly faster.
=> Only orders which

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2022-12-27 14:05:31 UTC
I understand where this is coming from, but we should really just copy and paste the API-based paginated orders table from parcel.tt and change some query parameters to match this use case...

I can help if needed.
Comment 5 Emmi Takkinen 2022-12-29 07:16:47 UTC
(In reply to Tomás Cohen Arazi from comment #4)
> I understand where this is coming from, but we should really just copy and
> paste the API-based paginated orders table from parcel.tt and change some
> query parameters to match this use case...
> 
> I can help if needed.

That is definitely a better solution in a long run. My plan was to first provide syspref as a simpler solution and then examine if we can optimize code in a different bug. 

I'll try adding that paginated table here and ask help if there are any problems.