mirror of
https://github.com/derf/travelynx
synced 2024-12-03 01:39:10 +00:00
work: Not finding a train at the destination is usually not an error
This commit is contained in:
parent
3de5de7db2
commit
fb2a06c59c
1 changed files with 17 additions and 8 deletions
|
@ -20,10 +20,10 @@ sub run {
|
||||||
$db->select( 'in_transit_str', '*', { cancelled => 0 } )->hashes->each )
|
$db->select( 'in_transit_str', '*', { cancelled => 0 } )->hashes->each )
|
||||||
{
|
{
|
||||||
|
|
||||||
my $uid = $entry->{user_id};
|
my $uid = $entry->{user_id};
|
||||||
my $dep = $entry->{dep_ds100};
|
my $dep = $entry->{dep_ds100};
|
||||||
my $arr = $entry->{arr_ds100};
|
my $arr = $entry->{arr_ds100};
|
||||||
my $train = $entry->{train_id};
|
my $train_id = $entry->{train_id};
|
||||||
|
|
||||||
$self->app->log->debug("Processing $uid");
|
$self->app->log->debug("Processing $uid");
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ sub run {
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($train)
|
my ($train)
|
||||||
= first { $_->train_id eq $train } @{ $status->{results} };
|
= first { $_->train_id eq $train_id } @{ $status->{results} };
|
||||||
|
|
||||||
if ( not $train ) {
|
if ( not $train ) {
|
||||||
die("could not find train $train at $dep\n");
|
die("could not find train $train_id at $dep\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->update(
|
$db->update(
|
||||||
|
@ -77,10 +77,19 @@ sub run {
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($train)
|
my ($train)
|
||||||
= first { $_->train_id eq $train } @{ $status->{results} };
|
= first { $_->train_id eq $train_id } @{ $status->{results} };
|
||||||
|
|
||||||
if ( not $train ) {
|
if ( not $train ) {
|
||||||
die("could not find train $train at $arr\n");
|
if ( $entry->{real_arr_ts} ) {
|
||||||
|
die(
|
||||||
|
"could not find train $train_id at $arr -- did it disappear?\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# If we haven't seen the train yet, its arrival is probably
|
||||||
|
# too far in the future. This is not critical.
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->update(
|
$db->update(
|
||||||
|
|
Loading…
Reference in a new issue