Job queue: Difference between revisions

1,194 bytes added ,  4 October 2024
No edit summary
Line 9: Line 9:
* https://saintapedia.org/w/api.php?action=query&meta=siteinfo&siprop=statistics
* https://saintapedia.org/w/api.php?action=query&meta=siteinfo&siprop=statistics
* [[Special:ApiSandbox]]
* [[Special:ApiSandbox]]
== Example ==
=== Cron job ===
<nowiki>#</nowiki>!/bin/bash
<nowiki>#</nowiki> Put the MediaWiki installation path on the line below
MW_INSTALL_PATH="/home/www/www.mywikisite.example/mediawiki"
RUN_JOBS="$MW_INSTALL_PATH/maintenance/runJobs.php --maxtime=60"
echo Starting job service...
<nowiki>#</nowiki> Wait a minute after the server starts up to give other processes time to get started
sleep 1
echo Started.
while true; do
<nowiki>#</nowiki> Job types that need to be run ASAP no matter how many of them are in the queue
<nowiki>#</nowiki> Those jobs should be very "cheap" to run
php $RUN_JOBS --type="enotifNotify"
<nowiki>#</nowiki> Everything else, limit the number of jobs on each batch
<nowiki>#</nowiki> The --wait parameter will pause the execution here until new jobs are added,
<nowiki>#</nowiki> to avoid running the loop without anything to do
php $RUN_JOBS --wait --maxjobs=20
<nowiki>#</nowiki> Wait some seconds to let the CPU do other things, like handling web requests, etc
echo Waiting for 10 seconds...
sleep 10
done
=== Docker ===
<nowiki>*</nowiki> * * * * docker exec web php maintenance/runJobs.php --maxjobs 700 --maxtime=55
sudo crontab -e


== External ==
== External ==
266

edits