Skip to content

100% cpu usage when connect fails #192

Closed
bduggan opened this Issue Aug 2, 2011 · 2 comments

2 participants

@bduggan
bduggan commented Aug 2, 2011

When I run this :

use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new();
$ua->get( 'http://localhost:9999' => sub { 1; } );
Mojo::IOLoop->start;

..and there is no server listening on port 9999, CPU
usage goes to 100%.

I realize that adding "Mojo::IOLoop->stop" would prevent this, but I'd like to auto-retry within the event loop after 5 seconds instead of stopping, like this :

https://gist.github.com/1120245

That program works, but it uses 100% cpu when there is no connection.

thanks

@kraih
Owner
kraih commented Aug 2, 2011

Thanks, fixed. 41c1ef8

@kraih kraih closed this Aug 2, 2011
@bduggan
bduggan commented Aug 2, 2011

That fixed it. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.