I see, that Mojo::Pg use AutoInactiveDestroy DBI options for dbh, but I
have some issues with inactive handles in childs.
Minimal example:
use Mojolicious::Lite; use Minion; use Mojo::Pg; use Test::More; use
Test::Mojo; my $pg_uri = 'postgresql://and@/test'; app->plugin(Minion =>
{Pg => $pg_uri}); app->helper(pg => sub { state $pg =
Mojo::Pg->new($pg_uri) }); app->minion->add_task(test => sub {}); my
$worker = app->minion->worker->register; app->minion->on(enqueue => sub {
$worker->dequeue(1)->start }); get '/' => sub { my $c = shift; my $db =
$c->pg->db; my $tx = $db->begin; $db->query('select 1');
$c->minion->enqueue('test'); $tx->commit; $c->render(text => 'ok'); };
app->start; my $t = Test::Mojo->new; $t->get_ok('/')->status_is(200);
done_testing;
And result with strange warning:
app.pl .. [Wed Aug 17 11:30:32 2016] [debug] GET "/"
[Wed Aug 17 11:30:32 2016] [debug] Routing to a callback
[Wed Aug 17 11:30:32 2016] [debug] 200 OK (0.013601s, 73.524/s)
WARNING: there is no transaction in progress
ok 1 - GET /
ok 2 - 200 OK
1..2
ok
All tests successful.
Should Mojo::Pg close all dbh while fork? How I can avoid similar warnings?
--
Andrey Khozov
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.