Skip to main content

Introduction

Some work is too slow to do while a user waits, such as importing content or refreshing a connector’s tools. Aikeedo puts that work on a queue as jobs, and runs them in the background. Recurring work, such as renewing subscriptions, runs as scheduled tasks, each on its own schedule. Both run from the cron job, so cron is all you need, including on shared hosting. For faster background work, you can also keep a background worker running.
The scheduled tasks on this page are Aikeedo’s own recurring work. They are not the scheduled tasks your users create to run chat instructions on a schedule, although those are started by one of them: Run due scheduled tasks.

How it works

Cron runs cron.php every minute. Each run:
  1. Runs the scheduled tasks that are due. Each task runs on its own, so one that fails doesn’t stop the others. Its result shows on the Queue page.
  2. Works the queue for about 50 seconds, unless a background worker that handles every queue is running. A job added between cron runs therefore waits up to a minute.
A failed job is retried a few times with a pause in between. If it keeps failing, it is kept as a failed job for 30 days, so you can see why and retry it. While an update is unfinished, cron does nothing until it is finished. See How to Update.
Keep cron running every minute even if you add a background worker. The worker runs jobs; scheduled tasks still run from cron.

The Queue page

Go to Settings → System → Queue. When there are more workers, waiting jobs or failed jobs than the section shows, View all opens the full list. Click any job, worker or task to see its details:
  • Job: its name, queue, status, attempts, timeout, when it was added and when it is due, and its data. A failed job also shows its error and stack trace, with Retry.
  • Worker: the job it is running, who started it, the queues it works, jobs done, memory, when it will exit, and Restart.
  • Task: its schedule, Next run, last run and status, with the error and stack trace if it failed.

Jobs and Workers pages

  • Jobs lists every job, with Waiting and Failed tabs and a search. The Failed tab has Retry all and Delete all.
  • Workers lists every running worker, with a search, a Started by filter (Process manager or Cron) and Restart all.

Status page

The Status page in the admin menu also has Cron and Queue rows. They warn when cron hasn’t run for more than five minutes, when scheduled tasks are failing, and when jobs have failed.

Scheduled tasks

These are the tasks Aikeedo runs on its own. Plugins can add more, which also appear on the Queue page. Times are in UTC.

Running a background worker

A background worker is a process that keeps running and starts each job as soon as it is added. It is optional. Use one when jobs should start right away, or when you have many of them. Keep it running with a process manager such as Supervisor or systemd. The process manager starts the worker when the server boots and restarts it if it stops. You need only one of them.
The Run a background worker section of the Queue page shows these configurations with your paths, PHP binary and web server user filled in. Copy them from there.
  1. Install Supervisor if it isn’t installed: sudo apt install supervisor
  2. Save this as /etc/supervisor/conf.d/aikeedo-worker.conf:
  1. Load it and start the worker:
  1. Check that it is running: sudo supervisorctl status aikeedo-worker
Once it is running, the worker appears under Workers on the Queue page within a few seconds.
  • Run it as the web server user (www-data above). Otherwise files it creates, such as cache, can’t be changed by the application. The worker won’t run as root unless the application’s files belong to root.
  • Use the same PHP as the website. If your server has more than one PHP version, the Queue page’s configurations use the website’s by its full path, because plain php may be another version. Cron and workers log a warning when their PHP differs from the website’s.
  • Nothing to do after updates or settings changes. Workers restart on their own when you update Aikeedo or save settings.

Queue adapters

The adapter is where waiting jobs are kept. Change it with Change next to Adapter on the Queue page. The list shows only enabled adapters: turn on an adapter from a plugin under Settings → System → Queue adapters first. The Queue Adapters plugin adds Redis, Amazon SQS, Azure Queue Storage and Cloudflare Queues, which take that load off your database on busy sites. If the chosen adapter can’t be used, for example because its plugin was removed, jobs fall back to Database and a warning is logged.
Switching adapters doesn’t move jobs that are already waiting. Let the queue empty first: the Queue page shows how many jobs are waiting.

Troubleshooting

Set up the cron job to run cron.php every minute, as the web server user.
That is expected without a background worker: jobs run on the next cron run. Add a background worker to start them right away.
Open it on the Queue page to see the error and stack trace. If Run plugin cron listeners fails, the error names the plugin whose listener failed, so you know which one to update or contact.
Check the process manager’s status command and the worker log. Make sure the configuration uses the website’s PHP binary and the right path.

Need Help?

If you need assistance with Aikeedo:

Professional Support

Get expert help from our team with a paid support subscription

Troubleshooting Guide

Check common issues and solutions