XF 2.2 How long is $maxRunTime and can it be overridden?

VBX Co

Well-known member
We're using @truonglv's add-on to optimise images, and whilst you can specify a number of images to process per cron run of the main job - it max's out at around 200-380 images, regardless of how many more we put in the add-on's option.

Looking at the script it seems to be wrapped in public function run($maxRunTime) - so presumably, it is running for a specific amount of time and once it hits the time limit it stops foreach ($data as $contentType => $images) { if ($timer->limitExceeded()) { break; }

Does anyone know what the default time limit is, where it is set, and whether it can be overridden?

Thanks
 
Last edited:
Use the xf:run-jobs CLI tool to run jobs and cron tasks instead of the browser-based trigger (see "Job run trigger") - you can specify --max-execution-time on the command line. Default value is 55 seconds I believe.

I also have an addon which provides a bit more debugging info than the default XF tool does - https://xenforo.com/community/resources/cli-job-cron-runner.7931/ - provides a new hg:run-jobs command with a lot more options for debugging.
 
If the addon is using Jobs and not just a straight Cron task, there is also the XF config option jobMaxRunTime - which defaults to 8 seconds ... see https://xenforo.com/docs/xf2/config/#other-variables

Thanks - if we add an override for jobMaxRunTime to the config file, will it apply to all jobs? Just thinking that stretching it to 16 seconds might get us a lot more images processed over the next few days without, hopefully, causing too many problems with other jobs?
 
Top Bottom