Differential D19797 Diff 47275 src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php
Show First 20 Lines • Show All 766 Lines • ▼ Show 20 Lines | $log = PhabricatorRepositorySyncEvent::initializeNewEvent() | ||||
->setDeviceVersion($local_version) | ->setDeviceVersion($local_version) | ||||
->setFromDeviceVersion($remote_version); | ->setFromDeviceVersion($remote_version); | ||||
$sync_start = microtime(true); | $sync_start = microtime(true); | ||||
try { | try { | ||||
$future->resolvex(); | $future->resolvex(); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$sync_end = microtime(true); | $log->setSyncWait(phutil_microseconds_since($sync_start)); | ||||
$log->setSyncWait((int)(1000000 * ($sync_end - $sync_start))); | |||||
if ($ex instanceof CommandException) { | if ($ex instanceof CommandException) { | ||||
if ($future->getWasKilledByTimeout()) { | if ($future->getWasKilledByTimeout()) { | ||||
$result_type = PhabricatorRepositorySyncEvent::RESULT_TIMEOUT; | $result_type = PhabricatorRepositorySyncEvent::RESULT_TIMEOUT; | ||||
} else { | } else { | ||||
$result_type = PhabricatorRepositorySyncEvent::RESULT_ERROR; | $result_type = PhabricatorRepositorySyncEvent::RESULT_ERROR; | ||||
} | } | ||||
Show All 16 Lines | try { | ||||
'Synchronization of "%s" from leader "%s" failed: %s', | 'Synchronization of "%s" from leader "%s" failed: %s', | ||||
$device->getName(), | $device->getName(), | ||||
$binding->getDevice()->getName(), | $binding->getDevice()->getName(), | ||||
$ex->getMessage())); | $ex->getMessage())); | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
$sync_end = microtime(true); | |||||
$log | $log | ||||
->setSyncWait((int)(1000000 * ($sync_end - $sync_start))) | ->setSyncWait(phutil_microseconds_since($sync_start)) | ||||
->setResultCode(0) | ->setResultCode(0) | ||||
->setResultType(PhabricatorRepositorySyncEvent::RESULT_SYNC) | ->setResultType(PhabricatorRepositorySyncEvent::RESULT_SYNC) | ||||
->save(); | ->save(); | ||||
} | } | ||||
/** | /** | ||||
* @task internal | * @task internal | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |