- Added try/catch to each CRON ran to avoid blocking others
This commit is contained in:
parent
2f78a1b97d
commit
78daf88d67
@ -13,7 +13,7 @@ use Lean\Lean;
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
CronardMiddleware::class => function($c) {
|
CronardMiddleware::class => function($c) {
|
||||||
$cronardMiddleware = new CronardMiddleware($c, getenvonce('CRON_KEY'), function() : ResponseInterface {
|
$cronardMiddleware = new CronardMiddleware($c, getenv('CRON_KEY'), function() : ResponseInterface {
|
||||||
return new HtmlResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s')));
|
return new HtmlResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s')));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@ -18,9 +18,14 @@ trait CronardTrait {
|
|||||||
$cronard = new Cronard();
|
$cronard = new Cronard();
|
||||||
|
|
||||||
foreach($this->crontabs as $tab) {
|
foreach($this->crontabs as $tab) {
|
||||||
|
try {
|
||||||
$cronard->setTab(stripslashes($tab['cron']));
|
$cronard->setTab(stripslashes($tab['cron']));
|
||||||
$cronard->run(array_merge($this->variables, $variables), $tab['callback']);
|
$cronard->run(array_merge($this->variables, $variables), $tab['callback']);
|
||||||
}
|
}
|
||||||
|
catch(\Throwable $ex) {
|
||||||
|
error_log($ex->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fromFile(string $filepath) : self
|
public function fromFile(string $filepath) : self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user