ua->ioloop->stop doesn't work

28 views
Skip to first unread message

Alex Efros

unread,
Aug 2, 2014, 6:41:34 AM8/2/14
to mojol...@googlegroups.com
Hi!

Looks like $ua->ioloop->stop doesn't have any effect:

$ time perl -Mojo -E 'app->ua->get("google.com",sub{shift->ioloop->stop}); Mojo::IOLoop->start'

real 0m21.112s
user 0m0.170s
sys 0m0.007s

Mojo::IOLoop->stop does work:

$ time perl -Mojo -E 'app->ua->get("google.com",sub{Mojo::IOLoop->stop}); Mojo::IOLoop->start'
(in cleanup) Can't call method "remove" on an undefined value at /usr/lib64/perl5/vendor_perl/5.18.2/Mojo/UserAgent.pm line 82 during global destruction.

real 0m0.410s
user 0m0.149s
sys 0m0.016s

Any ideas why $ua->ioloop->stop doesn't work?

--
WBR, Alex.

Alex Efros

unread,
Aug 3, 2014, 6:46:32 AM8/3/14
to mojol...@googlegroups.com
Hi!

Answer to my both questions is: because each Mojo::UserAgent instance by
default use two different event loops - Mojo::IOLoop->singleton (usually
with EV reactor) for non-blocking requests and unique for each instance
$ua->ioloop (with Poll reactor) for blocking requests.

--
WBR, Alex.
Reply all
Reply to author
Forward
0 new messages