summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Stationboard.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm23
1 files changed, 16 insertions, 7 deletions
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 ) = @_;