From 815c25a894427ea0e916282a81ce5d5516fc2b0b Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Wed, 28 Sep 2022 06:19:41 +0000 Subject: [PATCH] Add locking and unlocking for warranty serial queue table when deleting an entry. #708 --- src/Command/LoadWarrantySerialCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Command/LoadWarrantySerialCommand.php b/src/Command/LoadWarrantySerialCommand.php index ac5d505d..f7bd5797 100644 --- a/src/Command/LoadWarrantySerialCommand.php +++ b/src/Command/LoadWarrantySerialCommand.php @@ -392,12 +392,18 @@ class LoadWarrantySerialCommand extends Command { // prepared statement $db = $this->em->getConnection(); + + // lock the warranty serial queue table + $db->exec('LOCK TABLES warranty_serial_queue WRITE;'); + $delete_stmt = $db->prepare('DELETE FROM warranty_serial_queue WHERE id = :id'); $res = $delete_stmt->execute([ ':id' => $id, ]); + + $db->exec('UNLOCK TABLES;'); } protected function setOutputInfo($filename, $file_id, $has_error, $error_message, $entries, $orig_filename)