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

@@ -9,7 +9,6 @@ use App\Models\EventBookmaker;
use App\Models\Sport;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
use PDOException;
class Fixtures
{
@@ -101,33 +100,12 @@ class Fixtures
FindFixture::find($event);
if (isset($event['id'])) {
EventBookmaker::updateOrCreate([
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'starttime' => $event['starttime']]);
$event_id_collector[] = $event['id'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$handle = EventBookmaker::updateOrCreate([
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'starttime' => $event['starttime']]);
return $handle;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
}