Fix has_wagonorder_p logic. request success ≠ result success!
This commit is contained in:
parent
cabf159f46
commit
bb22915fc3
1 changed files with 14 additions and 3 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue