From dc072501ccdb25fa337aa1c77bc2fddd16e019ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 6 Jan 2016 18:04:57 +0100 Subject: [PATCH] Catch \Throwable in BackgroundQueueHandler --- .../background/BackgroundQueueHandler.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php b/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php index 071161a84f..1d300f8e99 100644 --- a/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php +++ b/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php @@ -92,6 +92,18 @@ class BackgroundQueueHandler extends SingletonFactory { SessionHandler::getInstance()->changeUser(new User(null), true); $job->perform(); } + catch (\Throwable $e) { + // gotta catch 'em all + $job->fail(); + + if ($job->getFailures() <= $job::MAX_FAILURES) { + $this->enqueueIn($job, $job->retryAfter()); + } + else { + // job failed too often: log + \wcf\functions\exception\logThrowable($e); + } + } catch (\Exception $e) { // gotta catch 'em all $job->fail(); @@ -168,6 +180,10 @@ class BackgroundQueueHandler extends SingletonFactory { $this->performJob($job); } } + catch (\Throwable $e) { + // job is completely broken: log + \wcf\functions\exception\logThrowable($e); + } catch (\Exception $e) { // job is completely broken: log \wcf\functions\exception\logThrowable($e); -- 2.20.1