wip
This commit is contained in:
1 parent
ea049cdf22
commit
60df43f241
3 files changed
+24
-5
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands\Services\Tasks\Alarm;
|
||||
|
||||
use App\Models\EventBookmaker;
|
||||
use PDOException;
|
||||
|
||||
class AlarmStore
|
||||
{
|
||||
@@ -42,6 +43,23 @@ class AlarmStore
|
||||
}
|
||||
}
|
||||
|
||||
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user