Attempt to catch DB errors and abort the transaction, so that the queue continues to run.

This commit is contained in:
Deon George 2022-11-12 09:32:39 +11:00
parent e7ebaa85cb
commit 702a4e4f37
1 changed files with 10 additions and 1 deletions

View File

@ -343,7 +343,14 @@ class NodelistImport implements ShouldQueue
}
// Save the system record
$so->save();
try {
$so->save();
} catch (\Exception $e) {
Log::error(sprintf('%s:Error with line [%s] (%s)',self::LOGKEY,$line,$e->getMessage()),['fields'=>$fields]);
DB::rollBack();
throw new \Exception($e->getMessage());
}
// If our zone didnt exist, we'll create it with this system
if (! $zo->exists) {
@ -365,6 +372,8 @@ class NodelistImport implements ShouldQueue
} catch (\Exception $e) {
Log::error(sprintf('%s:Error with line [%s] (%s)',self::LOGKEY,$line,$e->getMessage()),['fields'=>$fields]);
DB::rollBack();
throw new \Exception($e->getMessage());
}
if (! ($c % 100)) {