Fix has_wagonorder_p logic. request success ≠ result success!

This commit is contained in:
Daniel Friesel 2019-12-16 22:15:37 +01:00
parent cabf159f46
commit bb22915fc3

View file

@ -1838,7 +1838,11 @@ sub startup {
my $promise = Mojo::Promise->new; my $promise = Mojo::Promise->new;
if ( my $content = $cache->get($url) ) { if ( my $content = $cache->get($url) ) {
if ( $content eq 'n' ) { if ( $content eq 'y' ) {
$promise->resolve;
return $promise;
}
elsif ( $content eq 'n' ) {
$promise->reject; $promise->reject;
return $promise; return $promise;
} }
@ -1846,8 +1850,15 @@ sub startup {
$self->ua->request_timeout(5)->head_p($url)->then( $self->ua->request_timeout(5)->head_p($url)->then(
sub { sub {
$cache->set( $url, 'y' ); my ($tx) = @_;
$promise->resolve; if ( $tx->result->is_success ) {
$cache->set( $url, 'y' );
$promise->resolve;
}
else {
$cache->set( $url, 'n' );
$promise->resolve;
}
} }
)->catch( )->catch(
sub { sub {