1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01:00

Throw a richer exception when updating tasks with expired leases

Summary: Include task ID and class when raising this exception. I took a brief stab at doing this generically, but (a) we specifically raise this exception outside of normal try/catch because we can't follow normal recovery rules for it and (b) we don't have a reasonable PhutilProxyException or similar right now which would preserve stack traces, and don't have builtin exception nesting support until PHP 5.3.

Test Plan: Faked this exception, verified we get more information in the logs.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2193

Differential Revision: https://secure.phabricator.com/D4205
This commit is contained in:
epriestley 2012-12-16 16:27:32 -08:00
parent 09f543e2e2
commit 4c7c518c63

View file

@ -55,7 +55,10 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
if ($this->leaseOwner) {
$current_server_time = $this->serverTime + (time() - $this->localTime);
if ($current_server_time >= $this->leaseExpires) {
throw new Exception("Trying to update task after lease expiration!");
$id = $this->getID();
$class = $this->getTaskClass();
throw new Exception(
"Trying to update Task {$id} ({$class}) after lease expiration!");
}
}
}