I have the following code:

use Mojo::Pg;
use Mojolicious::Lite;
use Test::Mojo;
use Test::More;

helper pg => sub { state $pg = Mojo::Pg->new('postgresql://
user:[email protected]/test') };

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

-- 
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 http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to