HAFAS: add debug output for HAFAS requests and caching
This commit is contained in:
parent
119f2ea96a
commit
d156e3389e
1 changed files with 9 additions and 0 deletions
|
@ -142,11 +142,14 @@ sub get_tripid_p {
|
||||||
my @results = $hafas->results;
|
my @results = $hafas->results;
|
||||||
|
|
||||||
if ( not @results ) {
|
if ( not @results ) {
|
||||||
|
$self->{log}->debug("get_tripid_p($train_desc): no results");
|
||||||
$promise->reject(
|
$promise->reject(
|
||||||
"journeyMatch($train_desc) returned no results");
|
"journeyMatch($train_desc) returned no results");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{log}->debug("get_tripid_p($train_desc): success");
|
||||||
|
|
||||||
my $result = $results[0];
|
my $result = $results[0];
|
||||||
if ( @results > 1 ) {
|
if ( @results > 1 ) {
|
||||||
for my $journey (@results) {
|
for my $journey (@results) {
|
||||||
|
@ -163,6 +166,7 @@ sub get_tripid_p {
|
||||||
)->catch(
|
)->catch(
|
||||||
sub {
|
sub {
|
||||||
my ($err) = @_;
|
my ($err) = @_;
|
||||||
|
$self->{log}->debug("get_tripid_p($train_desc): error $err");
|
||||||
$promise->reject($err);
|
$promise->reject($err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -192,15 +196,18 @@ sub get_journey_p {
|
||||||
my $journey = $hafas->result;
|
my $journey = $hafas->result;
|
||||||
|
|
||||||
if ($journey) {
|
if ($journey) {
|
||||||
|
$self->{log}->debug("get_journey_p($opt{trip_id}): success");
|
||||||
$promise->resolve($journey);
|
$promise->resolve($journey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$self->{log}->debug("get_journey_p($opt{trip_id}): no journey");
|
||||||
$promise->reject('no journey');
|
$promise->reject('no journey');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
sub {
|
sub {
|
||||||
my ($err) = @_;
|
my ($err) = @_;
|
||||||
|
$self->{log}->debug("get_journey_p($opt{trip_id}): error $err");
|
||||||
$promise->reject($err);
|
$promise->reject($err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -311,12 +318,14 @@ sub get_route_p {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{log}->debug("get_route_p($opt{trip_id}): success");
|
||||||
$promise->resolve( $ret, $journey, $polyline );
|
$promise->resolve( $ret, $journey, $polyline );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
)->catch(
|
)->catch(
|
||||||
sub {
|
sub {
|
||||||
my ($err) = @_;
|
my ($err) = @_;
|
||||||
|
$self->{log}->debug("get_route_p($opt{trip_id}): error $err");
|
||||||
$promise->reject($err);
|
$promise->reject($err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue