[Koha-bugs] [Bug 22417] Delegate background jobs execution

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 13 02:13:22 CEST 2020


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

--- Comment #49 from David Cook <dcook at prosentient.com.au> ---
(In reply to Tomás Cohen Arazi from comment #47)
> - I would like to know what ideas you might have for maintaining the 'tasks'
> catalog, specially when it comes to plugins (i.e. the mapping between
> background_job.type and the method that has to be run.

I am really interested in this too. 

> - I expected to see an event-driven implementation of the koha_worker.pl
> loop, as messages will arrive and we should react to them instead of
> polling. Maybe it is a limitation from Net::STOMP, I saw there's
> AnyEvent::STOMP which is event-driven. Maybe the 'blocking and waiting for a
> frame' behaviour from Net::STOMP::receive_frame works similarly... worth
> checking.

As you say, "blocking and waiting for a frame" is event-driven behaviour, so
koha_worker.pl is already event-driven.

Net::STOMP and AnyEvent::STOMP both use a select-based event loop. (AnyEvent
can use other event loops apparently, but you have to load them. Plus the
performance gained using a more sophisticated event loop is likely marginal for
our use cases.)

> I will organise my work so I can spend some hours on redoing this using
> AnyEvent::Task::Server and AnyEvent::Task::Client as I wrote a POC a lot of
> time ago.
> 

That looks interesting! Can I suggest that you use a TCP socket rather than a
Unix socket? For my POE-based task scheduler in Bug 10662 (which was similar to
this but included timers for task scheduling) I used a Unix socket and it
worked fine, but it meant my scheduler has to be on the same machine; in
hindsight, I wish I had used a TCP socket. With a TCP socket, it would make
Dockerization easier and could make production deployments easier (depending on
how the workers are done). 

Actually, how do you see AnyEvent::Task fitting in with RabbitMQ or task
scheduling? The AnyEvent::Task::Server would sit in the background... would
your koha_worker.pl be the RabbitMQ consumer and AnyEvent::Task::Client?

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


More information about the Koha-bugs mailing list