diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-06-29 05:48:05 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-06-29 05:48:05 +0200 |
commit | 3b80a60300472349630ce81fd8ca6534e9a24a20 (patch) | |
tree | f92aaba053a65de22fddf85fa1caa731752f6019 | |
parent | f136a53b56961d6a1704670198bf20a66917db9b (diff) |
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
-rw-r--r-- | lib/Travelynx/Command/work.pm | 10 |
1 files changed, 6 insertions, 4 deletions
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} |