diff --git a/lib/Conch/Plugin/Database.pm b/lib/Conch/Plugin/Database.pm index 23c01af31..432a49a6c 100644 --- a/lib/Conch/Plugin/Database.pm +++ b/lib/Conch/Plugin/Database.pm @@ -54,15 +54,15 @@ See L; can be used interchangeably with it. =head2 ro_schema Provides (guaranteed) read-only access to the database via L. Returns a -L object that persists for the lifetime of the application. +L object that persists for the lifetime of the request (B). Note that because of the use of C<< AutoCommit => 0 >>, database errors must be explicitly cleared with C<< ->txn_rollback >>; see L. =cut - my $_ro_schema; - $app->helper(ro_schema => sub { + $app->helper(ro_schema => sub ($c) { + my $_ro_schema = $c->stash('ro_schema'); if ($_ro_schema) { # clear the transaction of any errors, which accumulate because we have # AutoCommit => 0 for this connection. Otherwise, we will get: @@ -84,6 +84,8 @@ cleared with C<< ->txn_rollback >>; see L. AutoCommit => 0, }, ); + $c->stash('ro_schema', $_ro_schema); + return $_ro_schema; }); =head2 db_s, db_ro_
s diff --git a/t/git-docs.t b/t/git-docs.t deleted file mode 100644 index 90b1588f4..000000000 --- a/t/git-docs.t +++ /dev/null @@ -1,13 +0,0 @@ -use strict; -use warnings; - -use Test::More; -plan skip_all => 'no .git: cannot check dirty files' if not -d '.git'; - -system(qw(make ghdocs)); - -chomp(my $dirty = `git status --untracked --porcelain docs`); -is(split("\n", $dirty), 0, 'no files changed after running "make ghdocs"') - or diag 'files need updating:',"\n",$dirty; - -done_testing;