[Koha-bugs] [Bug 26791] Build Mojolicious controller replacement for export.pl

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Oct 26 02:07:46 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26791

--- Comment #11 from David Cook <dcook at prosentient.com.au> ---
Sebastian Riedel, the founder of Mojolicious, mentioned that the drain callback
is the only way to do streaming in Mojolicious, since it relies on an event
loop and non-blocking I/O, which makes sense. 

You write some data to the buffer, enqueue an event, the event loop processes
the queue (which could include other events like a new web request, some I/O,
or whatever), and then you repeat the process over and over until you're out of
data. This asynchronous style is not the most intuitive to write, but it does
make for a much more powerful and robust web server.

Sebastian also mentioned promises and async/await. The async/await
(https://docs.mojolicious.org/Mojolicious/Guides/Cookbook#async-await) looks
very user-friendly, but it's an *experimental* feature and requires at least
Perl 5.16+ I think and preferrably 5.24+. (Note Debian Stretch comes with perl
5.24.)

Alternatively, I could look at wrapping it in a Mojo::Promise. That might help
in terms of readability/maintainability at least.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list