summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Stationboard.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-09-16 17:21:49 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-09-16 17:21:49 +0200
commit2ca4a50194108d378b961fb8ddc9a0455933d96d (patch)
treee9e7dee370b54f473bdfcaad543f085dd16a92d4 /lib/DBInfoscreen/Controller/Stationboard.pm
parent65aab8c7f827d0c0edf1249ea30c287c5f91ace8 (diff)
all requests but IRIS are async now
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 ) = @_;