Skip to content

Commit

Permalink
DBDB: use realtime cache for carriage composition requests
Browse files Browse the repository at this point in the history
  • Loading branch information
derf committed May 30, 2024
1 parent 2576a46 commit 9442572
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions lib/Travelynx.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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},
);
}
);
Expand Down
6 changes: 3 additions & 3 deletions lib/Travelynx/Helper/DBDB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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") ) {
Expand Down Expand Up @@ -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) ) {
Expand Down Expand Up @@ -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) ) {
Expand Down

0 comments on commit 9442572

Please sign in to comment.