@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Recover more cleanly from worker tasks with unconstructable classes

Summary:
This is unusual, but if `getWorkerInstance()` throws we end up with an undefined `$worker` when recovering from the exception.

Instead, handle this case slightly more gracefully.

The easiest way to hit this is to schedule a task for a worker that doesn't exist (or remove an existing worker, which is what I did to hit it).

Test Plan: Saw a more graceful error recovery; ran some normal successful tasks out of the queue.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11413

+6 -1
+6 -1
src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
··· 135 135 $this->checkLease(); 136 136 137 137 $did_succeed = false; 138 + $worker = null; 138 139 try { 139 140 $worker = $this->getWorkerInstance(); 140 141 ··· 182 183 $this->setFailureCount($this->getFailureCount() + 1); 183 184 $this->setFailureTime(time()); 184 185 185 - $retry = $worker->getWaitBeforeRetry($this); 186 + $retry = null; 187 + if ($worker) { 188 + $retry = $worker->getWaitBeforeRetry($this); 189 + } 190 + 186 191 $retry = coalesce( 187 192 $retry, 188 193 PhabricatorWorkerLeaseQuery::getDefaultWaitBeforeRetry());