Page MenuHomePhabricator

D8023.id18144.diff
No OneTemporary

D8023.id18144.diff

Index: src/applications/daemon/controller/PhabricatorDaemonConsoleController.php
===================================================================
--- src/applications/daemon/controller/PhabricatorDaemonConsoleController.php
+++ src/applications/daemon/controller/PhabricatorDaemonConsoleController.php
@@ -73,6 +73,7 @@
$logs = id(new PhabricatorDaemonLogQuery())
->setViewer($user)
->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)
+ ->setAllowStatusWrites(true)
->execute();
$taskmasters = 0;
Index: src/applications/daemon/controller/PhabricatorDaemonLogListController.php
===================================================================
--- src/applications/daemon/controller/PhabricatorDaemonLogListController.php
+++ src/applications/daemon/controller/PhabricatorDaemonLogListController.php
@@ -12,6 +12,7 @@
$logs = id(new PhabricatorDaemonLogQuery())
->setViewer($viewer)
+ ->setAllowStatusWrites(true)
->executeWithCursorPager($pager);
$daemon_table = new PhabricatorDaemonLogListView();
Index: src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
===================================================================
--- src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
+++ src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
@@ -16,6 +16,7 @@
$log = id(new PhabricatorDaemonLogQuery())
->setViewer($user)
->withIDs(array($this->id))
+ ->setAllowStatusWrites(true)
->executeOne();
if (!$log) {
return new Aphront404Response();
Index: src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php
===================================================================
--- src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php
+++ src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php
@@ -34,6 +34,7 @@
$daemon = id(new PhabricatorDaemonLogQuery())
->setViewer($this->getViewer())
->withIDs(array($id))
+ ->setAllowStatusWrites(true)
->executeOne();
if (!$daemon) {
Index: src/applications/daemon/query/PhabricatorDaemonLogQuery.php
===================================================================
--- src/applications/daemon/query/PhabricatorDaemonLogQuery.php
+++ src/applications/daemon/query/PhabricatorDaemonLogQuery.php
@@ -9,6 +9,7 @@
private $ids;
private $status = self::STATUS_ALL;
private $daemonClasses;
+ private $allowStatusWrites;
public static function getTimeUntilUnknown() {
return 3 * PhutilDaemonOverseer::HEARTBEAT_WAIT;
@@ -33,6 +34,11 @@
return $this;
}
+ public function setAllowStatusWrites($allow) {
+ $this->allowStatusWrites = $allow;
+ return $this;
+ }
+
public function loadPage() {
$table = new PhabricatorDaemonLog();
$conn_r = $table->establishConnection('r');
@@ -80,11 +86,16 @@
$status = $status_dead;
}
- // If we changed the daemon's status, update it.
+ // If we changed the daemon's status, adjust it.
if ($status != $daemon->getStatus()) {
- $guard = AphrontWriteGuard::beginScopedUnguardedWrites();
- $daemon->setStatus($status)->save();
- unset($guard);
+ $daemon->setStatus($status);
+
+ // ...and write it, if we're in a context where that's reasonable.
+ if ($this->allowStatusWrites) {
+ $guard = AphrontWriteGuard::beginScopedUnguardedWrites();
+ $daemon->save();
+ unset($guard);
+ }
}
// If the daemon no longer matches the filter, get rid of it.

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 3, 9:44 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6749030
Default Alt Text
D8023.id18144.diff (3 KB)

Event Timeline