DBDB: use realtime cache for carriage composition requests

This commit is contained in:
Birte Kristina Friesel 2024-05-30 11:53:33 +02:00
parent 2576a463db
commit 9442572084
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 9 additions and 8 deletions

View file

@ -362,11 +362,12 @@ sub startup {
dbdb => sub {
my ($self) = @_;
state $dbdb = Travelynx::Helper::DBDB->new(
log => $self->app->log,
cache => $self->app->cache_iris_main,
root_url => $self->base_url_for('/')->to_abs,
user_agent => $self->ua,
version => $self->app->config->{version},
log => $self->app->log,
main_cache => $self->app->cache_iris_main,
realtime_cache => $self->app->cache_iris_rt,
root_url => $self->base_url_for('/')->to_abs,
user_agent => $self->ua,
version => $self->app->config->{version},
);
}
);

View file

@ -31,7 +31,7 @@ sub has_wagonorder_p {
my $api_ts = $ts->strftime('%Y%m%d%H%M');
my $url
= "https://ist-wr.noncd.db.de/wagenreihung/1.0/${train_no}/${api_ts}";
my $cache = $self->{cache};
my $cache = $self->{realtime_cache};
my $promise = Mojo::Promise->new;
if ( my $content = $cache->get("HEAD $url") ) {
@ -73,7 +73,7 @@ sub get_wagonorder_p {
my $url
= "https://ist-wr.noncd.db.de/wagenreihung/1.0/${train_no}/${api_ts}";
my $cache = $self->{cache};
my $cache = $self->{realtime_cache};
my $promise = Mojo::Promise->new;
if ( my $content = $cache->thaw($url) ) {
@ -113,7 +113,7 @@ sub get_stationinfo_p {
my $url = "https://lib.finalrewind.org/dbdb/s/${eva}.json";
my $cache = $self->{cache};
my $cache = $self->{main_cache};
my $promise = Mojo::Promise->new;
if ( my $content = $cache->thaw($url) ) {