| Summary: | Does Koha::Database->schema always return a connected object? | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> | 
| Component: | Architecture, internals, and plumbing | Assignee: | Bugs List <koha-bugs> | 
| Status: | NEW --- | QA Contact: | Testopia <testopia> | 
| Severity: | enhancement | ||
| Priority: | P5 - low | ||
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 | 
| Patch complexity: | --- | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: | Circulation function: | ||
| For the record:
-        return $database->{schema} if defined $database->{schema};
+        my $schema = $database->{schema};
+        if( $schema && $schema->storage->connected ) {
+            return $schema; | 
My log says no: DBD::mysql::st execute failed: MySQL server has gone away [for Statement "SELECT `me`.`variable`, `me`.`value`, `me`.`options`, `me`.`explanation`, `me`.`type` FROM `systempreferences` `me` WHERE ( `me`.`variable` = ? )" with ParamValues: 0='opacgroupresults'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832. I see them quite often, always for preferences. Note that we do not test the cached $database->{schema} in sub schema. If we do, we will however add some time. ( 0.0043 instead of 0.0003 ) What do you think?