diff options
author | Daniel Friesel <derf@finalrewind.org> | 2022-01-30 11:28:30 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2022-01-30 11:28:30 +0100 |
commit | e89ed392bb06abf8cc36d31b3b033ef2b2abf57b (patch) | |
tree | f036992140c30e05a54ae75349d215b9ca496b48 /lib/Travel/Status | |
parent | f223e10169b5b5bb57a270f7d6631d8ffb62050b (diff) |
Gracefully handle failed realtime data requests
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r-- | lib/Travel/Status/DE/IRIS.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 1be5808..79e96d9 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -135,10 +135,20 @@ sub new_p { for my $eva (@related_stations) { push( @realtime_reqs, $self->get_realtime_p( $eva, $dt_req ) ); } - return $self->{promise}->all(@realtime_reqs); + return $self->{promise}->all_settled(@realtime_reqs); } )->then( sub { + my @realtime_results = @_; + + for my $realtime_result (@realtime_results) { + if ( $realtime_result->{status} eq 'rejected' ) { + $self->{warnstr} //= q{}; + $self->{warnstr} + .= "Realtime data request failed: $realtime_result->{reason}. "; + } + } + $self->postprocess_results; $promise->resolve($self); return; |