-
-
Save Logioniz/8d4c49cb649ecc116253 to your computer and use it in GitHub Desktop.
Mojo test inactivity_timeout long operation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::Base -strict; | |
use Mojo::IOLoop; | |
use Mojolicious::Lite; | |
use Test::More; | |
use Test::Mojo; | |
get '/' => sub { | |
my $c = shift->render_later; | |
$c->inactivity_timeout(40); | |
$c->delay( | |
sub { Mojo::IOLoop->timer(30 => shift->begin) }, | |
sub { $c->render(json => {result => 'ok'}) } | |
); | |
}; | |
my $t = Test::Mojo->new; | |
$t->ua->inactivity_timeout(40); | |
$t->ua->max_connections(0); | |
$t->get_ok('/')->status_is(200)->json_is('/result' => 'ok'); | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment