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

Add order-by-ID to PhabricatorWorkerTriggerQuery

Summary:
Ref T6881. By design, the EXECUTION order only selects tasks which have been scheduled (since it performs a JOIN). This is inconsistent with other queries and problematic for withID/withPHID queries which may want to select an unscheduled task.

Switch to standard ID ordering by default.

Test Plan:
- Instances console now finds unscheduled triggers.
- Verified that all existing queries specify an explicit order.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6881

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

+16 -1
+16 -1
src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
··· 3 3 final class PhabricatorWorkerTriggerQuery 4 4 extends PhabricatorOffsetPagedQuery { 5 5 6 + const ORDER_ID = 'id'; 6 7 const ORDER_EXECUTION = 'execution'; 7 8 const ORDER_VERSION = 'version'; 8 9 ··· 14 15 private $nextEpochMax; 15 16 16 17 private $needEvents; 17 - private $order = self::ORDER_EXECUTION; 18 + private $order = self::ORDER_ID; 18 19 19 20 public function withIDs(array $ids) { 20 21 $this->ids = $ids; ··· 43 44 return $this; 44 45 } 45 46 47 + /** 48 + * Set the result order. 49 + * 50 + * Note that using `ORDER_EXECUTION` will also filter results to include only 51 + * triggers which have been scheduled to execute. You should not use this 52 + * ordering when querying for specific triggers, e.g. by ID or PHID. 53 + * 54 + * @param const Result order. 55 + * @return this 56 + */ 46 57 public function setOrder($order) { 47 58 $this->order = $order; 48 59 return $this; ··· 185 196 186 197 private function buildOrderClause(AphrontDatabaseConnection $conn_r) { 187 198 switch ($this->order) { 199 + case self::ORDER_ID: 200 + return qsprintf( 201 + $conn_r, 202 + 'ORDER BY id DESC'); 188 203 case self::ORDER_EXECUTION: 189 204 return qsprintf( 190 205 $conn_r,