get_stationinfo_p: cache negative replies

This commit is contained in:
Daniel Friesel 2020-09-20 09:55:28 +02:00
parent 2316e03da9
commit 2788f97f32

View file

@ -116,6 +116,7 @@ sub get_stationinfo_p {
my ($tx) = @_; my ($tx) = @_;
if ( my $err = $tx->error ) { if ( my $err = $tx->error ) {
$cache->freeze( $url, {} );
$promise->reject("HTTP $err->{code} $err->{message}"); $promise->reject("HTTP $err->{code} $err->{message}");
return; return;
} }
@ -128,6 +129,7 @@ sub get_stationinfo_p {
)->catch( )->catch(
sub { sub {
my ($err) = @_; my ($err) = @_;
$cache->freeze( $url, {} );
$promise->reject($err); $promise->reject($err);
return; return;
} }