Running rcextension hooks in Background

Mads Kiilerich mads at kiilerich.com
Thu Dec 24 11:42:16 UTC 2015


On 12/18/2015 03:07 PM, Robert Rauch wrote:
> Hi,
>
> We have some rcextension Hooks in our Kallithea instance triggering e.g.
> Jenkins and so on. However, these Hooks slow down the actual Push
> actions, so it would be nice to run them asynchronously. So my question
> is, how this should be implemented? Can we simply run our tasks with
> `threading.Thread(target=...).start()`? (Bear with me that I am not a
> programmer at all)

I don't think it is a good idea to run it in a thread. The Kallithea 
server process is running inside a web server which gives a special 
runtime environment.

Instead I would suggest using celeryd as described in the documentation 
and extending it to run the push actions asynchronously. See for example 
how kallithea/model/notification.py invokes send_email in 
kallithea/lib/celerylib/tasks.py . It will however require some 
programming. But buying consulting services is a good way to support 
developers in the community ;-)

/Mads


More information about the kallithea-general mailing list