work: guard HAFAS updates via eval as well
This commit is contained in:
parent
170aa150b1
commit
f0b70c4dab
1 changed files with 102 additions and 92 deletions
|
@ -49,6 +49,8 @@ sub run {
|
||||||
|
|
||||||
if ( $entry->{is_hafas} ) {
|
if ( $entry->{is_hafas} ) {
|
||||||
|
|
||||||
|
eval {
|
||||||
|
|
||||||
$self->app->hafas->get_journey_p(
|
$self->app->hafas->get_journey_p(
|
||||||
trip_id => $train_id,
|
trip_id => $train_id,
|
||||||
service => $entry->{backend_name}
|
service => $entry->{backend_name}
|
||||||
|
@ -94,8 +96,8 @@ sub run {
|
||||||
train_type => $journey->type,
|
train_type => $journey->type,
|
||||||
train_no => $journey->number,
|
train_no => $journey->number,
|
||||||
);
|
);
|
||||||
$self->app->add_stationinfo( $uid, 1, $journey->id,
|
$self->app->add_stationinfo( $uid, 1,
|
||||||
$found_dep->loc->eva );
|
$journey->id, $found_dep->loc->eva );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +111,8 @@ sub run {
|
||||||
);
|
);
|
||||||
if ( $entry->{backend_id} <= 1
|
if ( $entry->{backend_id} <= 1
|
||||||
and $journey->class <= 16
|
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(
|
$self->app->add_wagonorder(
|
||||||
uid => $uid,
|
uid => $uid,
|
||||||
|
@ -120,15 +123,17 @@ sub run {
|
||||||
train_type => $journey->type,
|
train_type => $journey->type,
|
||||||
train_no => $journey->number,
|
train_no => $journey->number,
|
||||||
);
|
);
|
||||||
$self->app->add_stationinfo( $uid, 0, $journey->id,
|
$self->app->add_stationinfo( $uid, 0,
|
||||||
$found_dep->loc->eva, $found_arr->loc->eva );
|
$journey->id, $found_dep->loc->eva,
|
||||||
|
$found_arr->loc->eva );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
sub {
|
sub {
|
||||||
my ($err) = @_;
|
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.
|
# HAFAS do be weird. These are not actionable.
|
||||||
$self->app->log->debug("work($uid)/journey: $err");
|
$self->app->log->debug("work($uid)/journey: $err");
|
||||||
|
@ -152,6 +157,11 @@ sub run {
|
||||||
)->wait;
|
)->wait;
|
||||||
}
|
}
|
||||||
next;
|
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.
|
# TODO irgendwo ist hier ne race condition wo ein neuer checkin (in HAFAS) mit IRIS-Daten überschrieben wird.
|
||||||
|
|
Loading…
Reference in a new issue