diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-06-23 12:47:41 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-06-23 12:47:41 +0200 |
commit | 1db4f4cd432afac46b3526022bccb7ac6ba82920 (patch) | |
tree | 1df6ee10bd27060e501f8fe22c711e475a8174cd /lib | |
parent | 1184d848277a280fb5c5ef8da6a06bec87db15eb (diff) |
work: give bodged background tasks some time to complete
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travelynx/Command/work.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index 65fddc3..129ff45 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -324,6 +324,15 @@ sub run { if ( not $self->app->config->{traewelling}->{separate_worker} ) { $self->app->start('traewelling'); } + + # add_wagonorder and add_stationinfo assume a permanently running IOLoop + # and do not allow Mojolicious commands to wait until they have completed. + # Hence, some add_wagonorder and add_stationinfo calls made here may not + # complete before the work command exits, and thus have no effect. + # + # This is not ideal and will need fixing at some point. Until then, here + # is the pragmatic solution for 99% of the associated issues. + Mojo::Promise->timer(5)->wait; } 1; |