@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.

Daemons - add "objectPHID" to task tables.

Summary: Ref T5402. This more or less "fixes" it but there's probably some polish to do?

Test Plan:
stopped and started daemons. error logs look good.

ran bin/storage upgrade. noted that `adjust` added the appropriate indices for active and archive task.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T5402

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

+56 -13
+5
resources/sql/autopatches/20141223.daemonobjectphid.sql
··· 1 + ALTER TABLE {$NAMESPACE}_worker.worker_activetask 2 + ADD objectPHID VARBINARY(64); 3 + 4 + ALTER TABLE {$NAMESPACE}_worker.worker_archivetask 5 + ADD objectPHID VARBINARY(64);
+3 -1
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
··· 188 188 'emailPHIDs' => array_values($this->emailPHIDs), 189 189 'info' => $this->loadCommitInfoForWorker($all_updates), 190 190 ), 191 - PhabricatorWorker::PRIORITY_ALERTS); 191 + array( 192 + 'priority' => PhabricatorWorker::PRIORITY_ALERTS, 193 + )); 192 194 } 193 195 194 196 return 0;
+3 -1
src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
··· 50 50 $mailer_task = PhabricatorWorker::scheduleTask( 51 51 'PhabricatorMetaMTAWorker', 52 52 $message->getID(), 53 - PhabricatorWorker::PRIORITY_ALERTS); 53 + array( 54 + 'priority' => PhabricatorWorker::PRIORITY_ALERTS, 55 + )); 54 56 55 57 $console->writeOut( 56 58 "Queued message #%d for resend.\n",
+3 -1
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 342 342 $mailer_task = PhabricatorWorker::scheduleTask( 343 343 'PhabricatorMetaMTAWorker', 344 344 $this->getID(), 345 - PhabricatorWorker::PRIORITY_ALERTS); 345 + array( 346 + 'priority' => PhabricatorWorker::PRIORITY_ALERTS, 347 + )); 346 348 347 349 $this->saveTransaction(); 348 350
+3 -1
src/applications/search/index/PhabricatorSearchIndexer.php
··· 8 8 array( 9 9 'documentPHID' => $phid, 10 10 ), 11 - PhabricatorWorker::PRIORITY_IMPORT); 11 + array( 12 + 'priority' => PhabricatorWorker::PRIORITY_IMPORT, 13 + )); 12 14 } 13 15 14 16 public function indexDocumentByPHID($phid) {
+7 -3
src/infrastructure/daemon/workers/PhabricatorWorker.php
··· 94 94 final public static function scheduleTask( 95 95 $task_class, 96 96 $data, 97 - $priority = null) { 97 + $options = array()) { 98 98 99 + $priority = idx($options, 'priority'); 99 100 if ($priority === null) { 100 101 $priority = self::PRIORITY_DEFAULT; 101 102 } 103 + $object_phid = idx($options, 'objectPHID'); 102 104 103 105 $task = id(new PhabricatorWorkerActiveTask()) 104 106 ->setTaskClass($task_class) 105 107 ->setData($data) 106 - ->setPriority($priority); 108 + ->setPriority($priority) 109 + ->setObjectPHID($object_phid); 107 110 108 111 if (self::$runAllTasksInProcess) { 109 112 // Do the work in-process. ··· 114 117 $worker->doWork(); 115 118 foreach ($worker->getQueuedTasks() as $queued_task) { 116 119 list($queued_class, $queued_data, $queued_priority) = $queued_task; 117 - self::scheduleTask($queued_class, $queued_data, $queued_priority); 120 + $queued_options = array('priority' => $queued_priority); 121 + self::scheduleTask($queued_class, $queued_data, $queued_options); 118 122 } 119 123 break; 120 124 } catch (PhabricatorWorkerYieldException $ex) {
+1 -1
src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
··· 206 206 return PhabricatorWorker::scheduleTask( 207 207 'PhabricatorTestWorker', 208 208 $data, 209 - $priority); 209 + array('priority' => $priority)); 210 210 } 211 211 212 212 }
+10
src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
··· 9 9 const PHASE_EXPIRED = 'expired'; 10 10 11 11 private $ids; 12 + private $objectPHIDs; 12 13 private $limit; 13 14 private $skipLease; 14 15 ··· 36 37 37 38 public function withIDs(array $ids) { 38 39 $this->ids = $ids; 40 + return $this; 41 + } 42 + 43 + public function withObjectPHIDs(array $phids) { 44 + $this->objectPHIDs = $phids; 39 45 return $this; 40 46 } 41 47 ··· 173 179 174 180 if ($this->ids) { 175 181 $where[] = qsprintf($conn_w, 'id IN (%Ld)', $this->ids); 182 + } 183 + 184 + if ($this->objectPHIDs !== null) { 185 + $where[] = qsprintf($conn_w, 'objectPHID IN (%Ls)', $this->objectPHIDs); 176 186 } 177 187 178 188 return $this->formatWhereClause($where);
+7 -2
src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
··· 33 33 'leaseOwner_2' => array( 34 34 'columns' => array('leaseOwner', 'priority', 'id'), 35 35 ), 36 - ), 36 + ) + $parent[self::CONFIG_KEY_SCHEMA], 37 37 ); 38 38 39 39 $config[self::CONFIG_COLUMN_SCHEMA] = array( ··· 197 197 if ($did_succeed) { 198 198 foreach ($worker->getQueuedTasks() as $task) { 199 199 list($class, $data) = $task; 200 - PhabricatorWorker::scheduleTask($class, $data, $this->getPriority()); 200 + PhabricatorWorker::scheduleTask( 201 + $class, 202 + $data, 203 + array( 204 + 'priority' => $this->getPriority(), 205 + )); 201 206 } 202 207 } 203 208
+4 -2
src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php
··· 10 10 protected $result; 11 11 12 12 public function getConfiguration() { 13 + $parent = parent::getConfiguration(); 14 + 13 15 $config = array( 14 16 // We manage the IDs in this table; they are allocated in the ActiveTask 15 17 // table and moved here without alteration. 16 18 self::CONFIG_IDS => self::IDS_MANUAL, 17 - ) + parent::getConfiguration(); 19 + ) + $parent; 18 20 19 21 20 22 $config[self::CONFIG_COLUMN_SCHEMA] = array( ··· 29 31 'leaseOwner' => array( 30 32 'columns' => array('leaseOwner', 'priority', 'id'), 31 33 ), 32 - ); 34 + ) + $parent[self::CONFIG_KEY_SCHEMA]; 33 35 34 36 return $config; 35 37 }
+7
src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
··· 10 10 protected $failureCount; 11 11 protected $dataID; 12 12 protected $priority; 13 + protected $objectPHID; 13 14 14 15 private $data; 15 16 private $executionException; ··· 23 24 'failureCount' => 'uint32', 24 25 'failureTime' => 'epoch?', 25 26 'priority' => 'uint32', 27 + 'objectPHID' => 'phid?', 28 + ), 29 + self::CONFIG_KEY_SCHEMA => array( 30 + 'key_object' => array( 31 + 'columns' => array('objectPHID'), 32 + ), 26 33 ), 27 34 ) + parent::getConfiguration(); 28 35 }
+3 -1
src/infrastructure/sms/adapter/PhabricatorSMSImplementationAdapter.php
··· 81 81 'toNumbers' => $to_numbers, 82 82 'body' => $body, 83 83 ), 84 - PhabricatorWorker::PRIORITY_ALERTS); 84 + array( 85 + 'priority' => PhabricatorWorker::PRIORITY_ALERTS, 86 + )); 85 87 } 86 88 }