Skip to content

Problem: mysql errors don't cause jobs to be marked as failed #2344

@anvit

Description

@anvit

Current Behavior

Steps to reproduce the behavior

  1. Attempt to run any AtoM job which results in an error from MySQL (incorrect query, or the database being locked for instance).
  2. Look at the job output.
  3. Notice that the output says job succeeded despite the error message in the output

Expected Behavior

The job status should say failed not completed.

Possible Solution

arFileImportJob should mark these as failed and return when errors are encountered

if ($importer->hasErrors()) {
foreach ($importer->getErrors() as $error) {
$this->info($error);
}
}
// Try to remove tmp file from uploads/tmp.
if (isset($parameters['file']) && false === unlink($parameters['file']['tmp_name'])) {
// Issue warning if unable to delete but do not show job as failed because of this.
$this->error($this->i18n->__('Failed to delete temporary file %1 -- please check your folder permissions.', ['%1' => $parameters['file']['tmp_name']]));
}
// Mark job as complete.
$this->info($this->i18n->__('Import complete.'));
$this->job->setStatusCompleted();
$this->job->save();

Context and Notes

No response

Version used

No response

Operating System and version

No response

Default installation culture

No response

PHP version

No response

Contact details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugA flaw in the code that causes the software to produce an incorrect or unexpected result.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions