This should be on the outside instead. `if (OC_BackgroundJob::getExecutionType() === 'ajax') executeBackgroundJobs();`