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;
|
||||
|
||||
if ( my $content = $cache->get($url) ) {
|
||||
if ( $content eq 'n' ) {
|
||||
if ( $content eq 'y' ) {
|
||||
$promise->resolve;
|
||||
return $promise;
|
||||
}
|
||||
elsif ( $content eq 'n' ) {
|
||||
$promise->reject;
|
||||
return $promise;
|
||||
}
|
||||
|
@ -1846,9 +1850,16 @@ sub startup {
|
|||
|
||||
$self->ua->request_timeout(5)->head_p($url)->then(
|
||||
sub {
|
||||
my ($tx) = @_;
|
||||
if ( $tx->result->is_success ) {
|
||||
$cache->set( $url, 'y' );
|
||||
$promise->resolve;
|
||||
}
|
||||
else {
|
||||
$cache->set( $url, 'n' );
|
||||
$promise->resolve;
|
||||
}
|
||||
}
|
||||
)->catch(
|
||||
sub {
|
||||
$cache->set( $url, 'n' );
|
||||
|
|
Loading…
Reference in a new issue