add PDOException on updated odds

This commit is contained in:
salam committed 2026-02-06 17:24:48 +01:00
1 parent b35c8c48e3
commit 980b716271
15 files changed
+284 -21

No files matched your search

@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds3wayHt;
use App\Utilities\Margin;
use PDOException;
class _3WayHt
{
@@ -29,7 +30,25 @@ class _3WayHt
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$res->save();
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);
}
}
}