From 2ca4a50194108d378b961fb8ddc9a0455933d96d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 16 Sep 2020 17:21:49 +0200 Subject: all requests but IRIS are async now --- lib/DBInfoscreen/Controller/Stationboard.pm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm') diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 3b93ac3..1ea238c 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -412,13 +412,6 @@ sub render_train { ) ]; - if ( $departure->{wr_link} - and - not $self->wagonorder->is_available( $result, $departure->{wr_link} ) ) - { - $departure->{wr_link} = undef; - } - my $linetype = 'bahn'; if ( $departure->{train_type} eq 'S' ) { $linetype = 'sbahn'; @@ -446,6 +439,22 @@ sub render_train { $self->render_later; + # if wagonorder->is_available_p takes longer than get_route_timestamps_p, + # we'll have a useless (non-working) wagonorder link. That's okay. + if ( $departure->{wr_link} ) { + $self->wagonorder->is_available_p( $result, $departure->{wr_link} ) + ->then( + sub { + # great! + return; + }, + sub { + $departure->{wr_link} = undef; + return; + } + )->wait; + } + $self->hafas->get_route_timestamps_p( train => $result )->then( sub { my ( $route_ts, $route_info, $trainsearch ) = @_; -- cgit v1.2.3