Differential D19789 Diff 47302 src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/query/PhabricatorWorkerTaskQuery.php
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | public function withFailureCountBetween($min, $max) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setLimit($limit) { | public function setLimit($limit) { | ||||
| $this->limit = $limit; | $this->limit = $limit; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = array(); | ||||
| if ($this->ids !== null) { | if ($this->ids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'id in (%Ld)', | 'id in (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->objectPHIDs !== null) { | if ($this->objectPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'objectPHID IN (%Ls)', | 'objectPHID IN (%Ls)', | ||||
| $this->objectPHIDs); | $this->objectPHIDs); | ||||
| } | } | ||||
| if ($this->dateModifiedSince !== null) { | if ($this->dateModifiedSince !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'dateModified > %d', | 'dateModified > %d', | ||||
| $this->dateModifiedSince); | $this->dateModifiedSince); | ||||
| } | } | ||||
| if ($this->dateCreatedBefore !== null) { | if ($this->dateCreatedBefore !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'dateCreated < %d', | 'dateCreated < %d', | ||||
| $this->dateCreatedBefore); | $this->dateCreatedBefore); | ||||
| } | } | ||||
| if ($this->classNames !== null) { | if ($this->classNames !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'taskClass IN (%Ls)', | 'taskClass IN (%Ls)', | ||||
| $this->classNames); | $this->classNames); | ||||
| } | } | ||||
| if ($this->minFailureCount !== null) { | if ($this->minFailureCount !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'failureCount >= %d', | 'failureCount >= %d', | ||||
| $this->minFailureCount); | $this->minFailureCount); | ||||
| } | } | ||||
| if ($this->maxFailureCount !== null) { | if ($this->maxFailureCount !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'failureCount <= %d', | 'failureCount <= %d', | ||||
| $this->maxFailureCount); | $this->maxFailureCount); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
| } | } | ||||
| protected function buildOrderClause(AphrontDatabaseConnection $conn_r) { | protected function buildOrderClause(AphrontDatabaseConnection $conn_r) { | ||||
| // NOTE: The garbage collector executes this query with a date constraint, | // NOTE: The garbage collector executes this query with a date constraint, | ||||
| // and the query is inefficient if we don't use the same key for ordering. | // and the query is inefficient if we don't use the same key for ordering. | ||||
| // See T9808 for discussion. | // See T9808 for discussion. | ||||
| if ($this->dateCreatedBefore) { | if ($this->dateCreatedBefore) { | ||||
| Show All 17 Lines | |||||