Catch worker argument type errors
- This marks the invalid worker queue item as completed instead of endlessly retrying it - Address https://github.com/friendica/friendica/issues/11992#issuecomment-1327029331
This commit is contained in:
parent
a95e93c725
commit
ed7b175491
1 changed files with 9 additions and 1 deletions
|
@ -568,7 +568,15 @@ class Worker
|
|||
|
||||
// Set the workerLogger as new default logger
|
||||
if ($method_call) {
|
||||
try {
|
||||
call_user_func_array(sprintf('Friendica\Worker\%s::execute', $funcname), $argv);
|
||||
} catch (\TypeError $e) {
|
||||
// No need to defer a worker queue entry if the arguments are invalid
|
||||
Logger::notice('Wrong worker arguments', ['class' => $funcname, 'argv' => $argv, 'queue' => $queue, 'message' => $e->getMessage()]);
|
||||
} catch (\Throwable $e) {
|
||||
Logger::error('Uncaught exception in worker execution', ['class' => get_class($e), 'message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile() . ':' . $e->getLine(), 'trace' => $e->getTraceAsString()]);
|
||||
Worker::defer();
|
||||
}
|
||||
} else {
|
||||
$funcname($argv, count($argv));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue