add DB::transaction to catch looked query

This commit is contained in:
salam committed 2026-02-16 10:02:07 +01:00
1 parent f1b0f43ded
commit 65dc70e681
38 files changed
+218 -266

No files matched your search

@@ -3,7 +3,6 @@
namespace App\Console\Commands\Services\Tasks\Alarm;
use App\Models\EventBookmaker;
use PDOException;
class AlarmStore
{
@@ -43,23 +42,6 @@ class AlarmStore
}
}
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
}
}