Hi!
$ time perl -Mojo -E 'app->ua->get("
google.com",sub{}); Mojo::IOLoop->start'
real 0m21.106s
user 0m0.157s
sys 0m0.011s
This 20-second delay happens because inactive_timeout is set to 20, and
thus connection to
google.com kept alive after get() finish.
$ time perl -Mojo -E 'app->ua->get("
google.com"); Mojo::IOLoop->start'
real 0m0.388s
user 0m0.152s
sys 0m0.010s
But why same doesn't happens with blocking get? Isn't it also should keep
connection to
google.com alive after get() finish? At glance look at
source I don't see reason for this behaviour - both blocking and
non-blocking executed internal as non-blocking; and there are separate
keep-alive queues for blocking and non-blocking requests (so keep-alive
for blocking should work too).
--
WBR, Alex.