From: Tim Düsterhus Date: Wed, 6 Jan 2016 17:04:57 +0000 (+0100) Subject: Catch \Throwable in BackgroundQueueHandler X-Git-Tag: 3.0.0_Beta_1~2063 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc072501ccdb25fa337aa1c77bc2fddd16e019ee;p=GitHub%2FWoltLab%2FWCF.git Catch \Throwable in BackgroundQueueHandler --- 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);