I have the following code:
use Mojo::Pg;
use Mojolicious::Lite;
use Test::Mojo;
use Test::More;
app->pg->migrations->migrate;
get '/test' => sub {
my $c = shift;
$c->render_later;
$c->delay(
sub {
my $delay = shift;
$c->pg->db->query('insert into test (ts) values (now())' => $delay->begin);
},
sub {
my ($delay, $e, $res) = @_;
return $c->render_exception("Error while insert: $e") if $e;
$c->render(text => "Ok\n");
}
);
};
app->start;
my $t = Test::Mojo->new;
$t->get_ok('/test')->content_is("Ok\n");
$t->get_ok('/test')->content_is("Ok\n");
done_testing();
And I have strange behavior (timeout for curl and blocked ioloop for morbo) with second query to server.
If I remove the migration line, everything works well. Tests also work well.
I tried to use different postgres database (9.3 and 9.4RC), perl (5.18 and 5.20) and last version of Mojo::Pg.
Can someone confirm this behavior?
--
Andrey Khozov