save updates

This commit is contained in:
salam committed 2026-02-07 07:08:58 +01:00
1 parent 3671902fe7
commit 046407df18
36 files changed
+261 -305

No files matched your search

@@ -9,6 +9,7 @@ use App\Models\EventBookmaker;
use App\Models\Sport;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
use PDOException;
class Fixtures
{
@@ -104,11 +105,28 @@ class Fixtures
$event_id_collector[] = $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']]);
$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);
}
}
}