Skip to content

[bug]: Framework: Single Job failure makes all jobs after not run #11

@jfinstrom

Description

@jfinstrom

FreePBX Version

FreePBX 16

Issue Description

As mentioned by @kguptasangoma in FreePBX/certman#4 (comment) it seems that an exception on any Job running will kill the whole process. This can be easily fixed by wrapping the individual task in the job runner.
Example:

private function runJobs($jobs = []) {
    // ... (Existing code) ...

    foreach($jobs as $config) {

        // ... (Existing code within the loop) ...

        try { 
           // ... (Job execution logic) ... 
        } catch (\Exception $e) {
            $msg = "<error> ". sprintf(_("Error in the task %s Exception = %s"),$config['job'],$e->getMessage())." </error>";
            $this->writelog($msg);

            // Optionally, you might want to add specific failure handling or 
            // retry logic for the individual job here.
        }
    }

    // ... (Rest of the function) ...
}

Operating Environment

All versions FreePBX 15+

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    openIssue has been accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions