https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15350 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Jesse Weaver from comment #3)
Created attachment 48519 [details] [review] Bug 15350: Cache loaded DBIx::Class schema classes
This separates the Koha::Schema creation into two stages:
1) The loading of the schemas themselves, which is done upon import of Koha::Database. This requires moving the import of Koha::Schema from an on-demand `require` to just a `use`; most everything in Koha uses C4::Context, which will indirectly end up calling Koha::Database->schema->new anyway, so this was no longer saving anything.
Yes, I totally agree. This was previously done when our Plack implementation was not considered stable and we did not want to load the schema everywhere. Now we want.
2) The actual database connection, which is done by cloning the schema created above and adding a database connection.
I am not sure about this change, the Koha::Schema->connect will load all the classes (see Koha::Schema: 12 __PACKAGE__->load_namespaces;).
Note that this saves time only when a Plack-based Koha needs to create a database connection, which is usually only the case for a new worker.
Unscientific timings before patch: * First load of koha2marclinks.pl on a new worker: 0.70 seconds * Each load after: 0.17 seconds
After patch: * First load: 0.31 seconds * Each load after: 0.17 seconds
Are you sure it's brought by the ->clone call or just the move from require to use? :) -- You are receiving this mail because: You are watching all bug changes.