Bug 29032: Pre-load ILL backends to speed up response
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 15 Sep 2021 15:12:33 +0000 (12:12 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 21 Sep 2021 18:22:56 +0000 (20:22 +0200)
commit5e497a47a218ee7c222c4be02f284353f842113a
tree3fbaa19d2fc6bedc41d34d25dfa9ef0e9fbed156
parenta005865b813ef466f29c836c5ad65e8b69142f95
Bug 29032: Pre-load ILL backends to speed up response

Bug 22440 will rewrite the route and make it even more efficient by
prefetching the related data instead of performing several queries in
loops.

In the meantime, we can make this controller perform better with a
simple intervention: load backends once, and use the
$request->_backend() setter to pre-set it before using the objects.

To test:
1. Perform any usual ILL requests listing, try having several
=> FAIL: Notice it takes a weird amount of time to load
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: It feels fast enough!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/REST/V1/Illrequests.pm