From 6e5d0d6ebca64afc94f3f4cb04670d7a6e42ce79 Mon Sep 17 00:00:00 2001 From: Marina Gourtovaia Date: Thu, 24 Oct 2024 16:41:53 +0100 Subject: [PATCH] On-demand loading of ORM classes in npg_qc::autoqc::qc_store --- lib/npg_qc/autoqc/qc_store.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/npg_qc/autoqc/qc_store.pm b/lib/npg_qc/autoqc/qc_store.pm index d0bfa304..bbcfe3d9 100644 --- a/lib/npg_qc/autoqc/qc_store.pm +++ b/lib/npg_qc/autoqc/qc_store.pm @@ -11,7 +11,6 @@ use JSON; use Class::Load qw/load_class/; use npg_tracking::illumina::runfolder; -use npg_qc::Schema; use npg_qc::autoqc::qc_store::options qw/$ALL $ALLALL $LANES $PLEXES/; use npg_qc::autoqc::qc_store::query; use npg_qc::autoqc::role::result; @@ -68,6 +67,8 @@ has 'qc_schema' => ( sub _build_qc_schema { my $self = shift; if ($self->use_db) { + # Load ORM classes into memory only if they are needed. + load_class 'npg_qc::Schema'; return npg_qc::Schema->connect(); } return; @@ -595,6 +596,8 @@ __END__ =item Class::Load +=item npg_qc::Schema + =item npg_tracking::illumina::runfolder =back @@ -615,7 +618,7 @@ __END__ =head1 LICENSE AND COPYRIGHT -Copyright (C) 2019 GRL +Copyright (C) 2019, 2024 Genome Research Ltd. This file is part of NPG.