work: guard HAFAS updates via eval as well

This commit is contained in:
Birte Kristina Friesel 2024-08-16 16:52:14 +02:00
parent 170aa150b1
commit f0b70c4dab
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA

View file

@ -49,6 +49,8 @@ sub run {
if ( $entry->{is_hafas} ) {
eval {
$self->app->hafas->get_journey_p(
trip_id => $train_id,
service => $entry->{backend_name}
@ -94,8 +96,8 @@ sub run {
train_type => $journey->type,
train_no => $journey->number,
);
$self->app->add_stationinfo( $uid, 1, $journey->id,
$found_dep->loc->eva );
$self->app->add_stationinfo( $uid, 1,
$journey->id, $found_dep->loc->eva );
}
}
@ -109,7 +111,8 @@ sub run {
);
if ( $entry->{backend_id} <= 1
and $journey->class <= 16
and $found_arr->rt_arr->epoch - $now->epoch < 600 )
and $found_arr->rt_arr->epoch - $now->epoch
< 600 )
{
$self->app->add_wagonorder(
uid => $uid,
@ -120,15 +123,17 @@ sub run {
train_type => $journey->type,
train_no => $journey->number,
);
$self->app->add_stationinfo( $uid, 0, $journey->id,
$found_dep->loc->eva, $found_arr->loc->eva );
$self->app->add_stationinfo( $uid, 0,
$journey->id, $found_dep->loc->eva,
$found_arr->loc->eva );
}
}
}
)->catch(
sub {
my ($err) = @_;
if ( $err =~ m{svcResL\[0\][.]err is (?:FAIL|PARAMETER)$} )
if ( $err
=~ m{svcResL\[0\][.]err is (?:FAIL|PARAMETER)$} )
{
# HAFAS do be weird. These are not actionable.
$self->app->log->debug("work($uid)/journey: $err");
@ -152,6 +157,11 @@ sub run {
)->wait;
}
next;
};
if ($@) {
$errors += 1;
$self->app->log->error("work($uid)/hafas: $@");
}
}
# TODO irgendwo ist hier ne race condition wo ein neuer checkin (in HAFAS) mit IRIS-Daten überschrieben wird.