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 runscron.php every minute. Each run:
- 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.
- 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.
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.- Supervisor
- systemd
- Install Supervisor if it isn’t installed:
sudo apt install supervisor - Save this as
/etc/supervisor/conf.d/aikeedo-worker.conf:
- Load it and start the worker:
- Check that it is running:
sudo supervisorctl status aikeedo-worker
- Run it as the web server user (
www-dataabove). Otherwise files it creates, such as cache, can’t be changed by the application. The worker won’t run asrootunless the application’s files belong toroot. - 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
phpmay 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.
Troubleshooting
The Status page says cron has never run or hasn't run recently
The Status page says cron has never run or hasn't run recently
Set up the cron job to run
cron.php every minute, as the web server user.Jobs wait about a minute before they start
Jobs wait about a minute before they start
That is expected without a background worker: jobs run on the next cron run. Add a background worker to start them right away.
A scheduled task shows Failed
A scheduled task shows Failed
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.
The worker doesn't appear under Workers
The worker doesn't appear under Workers
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