XF 2.3 Handling long jobs

QuackieMackie

Active member
I've finally started adding offsite backups for my backup solution, and I ran into a Cloudflare issue.
So basically, when I run a manual job, it runs through the steps:
PHP:
    public function run($maxRunTime): JobResult
    {
        switch ($this->data['step'])
        {
            case 'creation':
            // database dump && file zip
            case 'cleanup':
            // old backup deletion
            case 'post-processing':
            // offsite copying
            return $this->complete();
        }
        return $this->complete();
    }
While the post-processing was happening, Cloudflare timed out my page. This was for a pretty small site backup (100mb roughly into the backup, by the time the timeout occurred). Has anyone dealt with this before, and how did you work around this?
 
Last edited:
don't do it with php. make a .sh script and put it on your server's cron tab to execute daily so you don't get stuck in browser and dns issues.
Well, that's not ideal. I wanted to have a full backup solution and not split it. :)
Thanks for the advice, I'll look into using .sh scripts instead.
 
Anything long running should be implemented as a CLI script.

$maxRunTime is set to 8 seconds by default - so use that as a guide - anything that could take longer and can't be broken up into multiple short steps - should not be run via the job system.
 
Back
Top Bottom