Differential D20553 Diff 49034 src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | private function waitUntilActive(DrydockLease $lease) { | ||||
$log_cursor = 0; | $log_cursor = 0; | ||||
$log_types = DrydockLogType::getAllLogTypes(); | $log_types = DrydockLogType::getAllLogTypes(); | ||||
$is_active = false; | $is_active = false; | ||||
while (!$is_active) { | while (!$is_active) { | ||||
$lease->reload(); | $lease->reload(); | ||||
$pager = id(new AphrontCursorPagerView()) | |||||
->setBeforeID($log_cursor); | |||||
// While we're waiting, show the user any logs which the daemons have | // While we're waiting, show the user any logs which the daemons have | ||||
// generated to give them some clue about what's going on. | // generated to give them some clue about what's going on. | ||||
$logs = id(new DrydockLogQuery()) | $logs = id(new DrydockLogQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withLeasePHIDs(array($lease->getPHID())) | ->withLeasePHIDs(array($lease->getPHID())) | ||||
->setBeforeID($log_cursor) | ->executeWithCursorPager($pager); | ||||
->execute(); | |||||
if ($logs) { | if ($logs) { | ||||
$logs = mpull($logs, null, 'getID'); | $logs = mpull($logs, null, 'getID'); | ||||
ksort($logs); | ksort($logs); | ||||
$log_cursor = last_key($logs); | $log_cursor = last_key($logs); | ||||
} | } | ||||
foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
$type_key = $log->getType(); | $type_key = $log->getType(); | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |