From 3b80a60300472349630ce81fd8ca6534e9a24a20 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 29 Jun 2025 05:48:05 +0200 Subject: work: limit dbris journey requests to 0.5 Hz If $backend is not set, we may have non-dbris checkins in between -- in that case, we don't need to wait as long --- lib/Travelynx/Command/work.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/Travelynx/Command/work.pm') diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index fa0a2ad..5ce7e8d 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -75,12 +75,14 @@ sub run { eval { - Mojo::Promise->timer( $dbris_rate_limited ? 4.5 : 1.0 )->then( + Mojo::Promise->timer( + $dbris_rate_limited ? 4.5 : ( $backend ? 2.0 : 1.0 ) ) + ->then( sub { return $self->app->dbris->get_journey_p( trip_id => $train_id ); } - )->then( + )->then( sub { my ($journey) = @_; @@ -173,7 +175,7 @@ sub run { )->wait; } } - )->catch( + )->catch( sub { my ($err) = @_; $self->app->log->debug( @@ -187,7 +189,7 @@ sub run { $backend_issues += 1; } } - )->wait; + )->wait; if ( $arr and $entry->{real_arr_ts} -- cgit v1.2.3