CLI Job Runner

xF2 Add-on CLI Job Runner 1.5.0

No permission to download
v1.5.0 makes some back-end changes to the way we manage the lock files and fixes an issue where long running jobs could see multiple job runners executing at the same time
  • code cleanup: we don't need a custom app class to show jobs
  • new CLI command: hg:show-crons
  • new CLI command: hg:run-cron
  • add logQuiet function to LoggerTrait
  • rebuilt Lock functionality to use a non-static class, managed by a SubContainer
  • ensure lock expiry is at least 30 seconds after the max execution time (10 minutes)
  • Love
Reactions: MadaraZip
v1.4.2 simply adds a check for the installer to prevent installation on XenForo 2.2 - need to install v2 of the JobRunner addon for XF 2.2 compatibility.

There is no need for existing users of this addon running on XenForo v2.1 to upgrade to v1.4.2
  • rename "Job run trigger" command to avoid issues after upgrading to XF v2.2
Note: If you have set the Job Run Trigger to "Server", you'll need to change it again after upgrading to v1.4.1 because the option name has changed

v1.4.0: Major update for XF v2.1

I've back-ported the new CLI Job Runner and debugger I built for XF v2.2 (which is a drop-in replacement for the built in xf:run-jobs command that comes with XF2.2).

THIS IS A MAJOR UPDATE - THERE ARE STEPS YOU MUST TAKE AFTER UPGRADING TO USE THIS NEW VERSION - SEE UPGRADE INSTRUCTIONS BELOW.

THIS VERSION IS NOT COMPATIBLE WITH XF v2.2
- please use the version available here: https://enxf.net/resources/cli-job-runner-for-xf-2-2.2523/

The command is called hg:run-jobs and does the same thing that xf:run-jobs does, but with more options and functionality.

Changes in this release
  • now includes an admin option to enable/disable the activity based trigger so you don't have to disable the addon to restore activity based triggers
  • allows commands to process jobs/crons for up to 10 minutes at a time, even when triggered every minute from a cron task (uses a lock file to prevent multiple executions in parallel) - ideal for improving job performance on high traffic sites
  • more logging functionality for debugging jobs and cron tasks
  • command has been renamed from xf:run-jobs to hg:run-jobs
  • XenForo v2.0 is no longer supported (it might work, but I haven't tested it)
  • Now requires PHP v7.0.0 or higher
Upgrading from v1.3
  1. Install v1.4.x of the addon
  2. change your unix cron entry to execute hg:run-jobs instead of xf:run-jobs - all parameters remain the same
  3. optional: adjust the --time option to anything up to 600 seconds (10 minutes) to allow job processing to take as long as it needs. For example: --time 180 will allow the Job Runner to execute for up to 3 minutes at a time
New features:
  • implemented debug logger for Job execution time tracking
  • extend the XF\Job\Cron class with new run function which logs execution time for cron tasks
  • added new Cli command and test job for testing purposes
Thanks to @Xon for identifying the bug fix where AJAX JSON responses would still trigger job.php; and for making suggestions on avoiding unnecessary database queries and prevent running cron jobs unless triggered via our CLI job runner
  • changes: disable calculations for job auto run time to avoid unnecessary database queries
  • bug fix: disable AJAX auto job runner from triggering from AJAX JSON responses
  • changes: don't allow cron tasks to execute unless triggered via the CLI job runner
  • changes: new icon
  • bug fix: should return 0 for successful execution
  • new feature: show-jobs command
  • Like
Reactions: ECWIN
Minor update for XF2.0 and now tested on XF2.1
  • we still want to run jobs if the user has disabled version checking in config
  • clear entity cache each time we run a job, to keep memory usage under control
  • Like
Reactions: ECWIN
Top