Improving the main loop.
This commit is contained in:
parent
998885b2a1
commit
6c44a9bb43
|
@ -26,7 +26,7 @@ has _ua => ( is => 'lazy', );
|
|||
|
||||
sub _build__ua {
|
||||
my $ua = Mojo::UserAgent->new->with_roles('+Queued');
|
||||
$ua->max_active(5);
|
||||
$ua->max_active(20);
|
||||
$ua->inactivity_timeout(60);
|
||||
return $ua;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,15 @@ sub run ($self) {
|
|||
}
|
||||
}
|
||||
|
||||
sub run_recursive ($self) {
|
||||
$self->_dispatch_updates.then(sub {
|
||||
$self->run_recursive;
|
||||
})->catch(sub ($err) {
|
||||
warn $err;
|
||||
$self->run_recursive;
|
||||
});
|
||||
}
|
||||
|
||||
sub _dispatch_updates ($self) {
|
||||
my $updates_p = $self->_get_updates;
|
||||
my $promise = Mojo::Promise->new;
|
||||
|
|
Loading…
Reference in New Issue