While I’ve not really had a chance to talk about it recently, owing to being rather busy, there has been a lot of work done in Known core recently.

Known uses event queues to dispatch things like Webmention pings. By default, this dispatching is synchronous. However, an advanced feature that was recently added, was the ability to enqueue events and have them dispatched later in an asynchronous fashion, enabling faster page loading.

Configuring

As mentioned above, by default Known uses a synchronous event queue. To use something the asynchronous queue, add the following line to your config.ini:

event_queue = 'AsynchronousQueue'

Next, you need to run the Known event queue dispatching service using the Known console tool:

./known service-event-queue

Note: if you’re using per-domain configuration you’ll need to set an environment variable in order for everything to work as expected:

export KNOWN_DOMAIN='your.domain.name'

Enjoy!

3 thoughts on “Asynchronous event queues

  1. Sometimes it is desirable to execute actions in the background and periodic intervals. Building on from last week’s post, I wanted to spotlight a new feature, which uses the asynchronous event queue, to allow you to do this – the periodic execution (cron) service.
    After completing the configuration step for enabling the Asynchronous Event Queue, you can then run the Known console periodic execution service:



    ./known.php service-cron


    1

    ./known.php servicecron


    Once running, this service will periodically trigger an event to which code can listen to. Available events are cron/minute, cron/hourly and cron/daily.


    Thanks for visiting! If you’re new here you might like to read a bit about me.
    (Psst… I am also available to hire! Find out more…)


    Follow @mapkyca
    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?’http’:’https’;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+’://platform.twitter.com/widgets.js’;fjs.parentNode.insertBefore(js,fjs);}}(document, ‘script’, ‘twitter-wjs’);


    Share this:EmailLinkedInTwitterGoogleFacebookReddit

  2. One of the deprecated features of Known is video support. This was build in to the Audio plugin back when it was the Media plugin, but it didn’t really work very well.
    The missing component was video transcoding – converting the uploaded video into something that can be played in the browser. This plugin attempts to fill that hole…
    Installation
    Drop VideoTranscode into your IdnoPlugins directory and activate
    Install ffmpeg sudo apt-get install ffmpeg x264
    Configure the location of ffmpeg and qt-faststart
    Now, when you upload a video, it will be queued and transcoded.
    It is strongly recommended that you use the Asynchronous Queue in your Known configuration as this will do the transcoding in the background.
    You should also run the service queue as the web server user, so that it can read and write files, e.g.



    sudo -u www-data KNOWN_DOMAIN=’your.domain’ ./known.php service-event-queue


    1

    sudo u wwwdata KNOWN_DOMAIN=‘your.domain’ ./known.php serviceeventqueue


    » Visit the project on Github…



    Thanks for visiting! If you’re new here you might like to read a bit about me.
    (Psst… I am also available to hire! Find out more…)


    Follow @mapkyca
    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?’http’:’https’;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+’://platform.twitter.com/widgets.js’;fjs.parentNode.insertBefore(js,fjs);}}(document, ‘script’, ‘twitter-wjs’);


    Share this:EmailLinkedInTwitterGoogleFacebookReddit

Leave a Reply