Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15532648
D11044.id26522.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D11044.id26522.diff
View Options
diff --git a/resources/sql/autopatches/20141223.daemonobjectphid.sql b/resources/sql/autopatches/20141223.daemonobjectphid.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20141223.daemonobjectphid.sql
@@ -0,0 +1,5 @@
+ALTER TABLE {$NAMESPACE}_worker.worker_activetask
+ ADD objectPHID VARBINARY(64);
+
+ALTER TABLE {$NAMESPACE}_worker.worker_archivetask
+ ADD objectPHID VARBINARY(64);
diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
--- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
+++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
@@ -188,7 +188,9 @@
'emailPHIDs' => array_values($this->emailPHIDs),
'info' => $this->loadCommitInfoForWorker($all_updates),
),
- PhabricatorWorker::PRIORITY_ALERTS);
+ array(
+ 'priority' => PhabricatorWorker::PRIORITY_ALERTS,
+ ));
}
return 0;
diff --git a/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
--- a/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
@@ -50,7 +50,9 @@
$mailer_task = PhabricatorWorker::scheduleTask(
'PhabricatorMetaMTAWorker',
$message->getID(),
- PhabricatorWorker::PRIORITY_ALERTS);
+ array(
+ 'priority' => PhabricatorWorker::PRIORITY_ALERTS,
+ ));
$console->writeOut(
"Queued message #%d for resend.\n",
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
@@ -342,7 +342,9 @@
$mailer_task = PhabricatorWorker::scheduleTask(
'PhabricatorMetaMTAWorker',
$this->getID(),
- PhabricatorWorker::PRIORITY_ALERTS);
+ array(
+ 'priority' => PhabricatorWorker::PRIORITY_ALERTS,
+ ));
$this->saveTransaction();
diff --git a/src/applications/search/index/PhabricatorSearchIndexer.php b/src/applications/search/index/PhabricatorSearchIndexer.php
--- a/src/applications/search/index/PhabricatorSearchIndexer.php
+++ b/src/applications/search/index/PhabricatorSearchIndexer.php
@@ -8,7 +8,9 @@
array(
'documentPHID' => $phid,
),
- PhabricatorWorker::PRIORITY_IMPORT);
+ array(
+ 'priority' => PhabricatorWorker::PRIORITY_IMPORT,
+ ));
}
public function indexDocumentByPHID($phid) {
diff --git a/src/infrastructure/daemon/workers/PhabricatorWorker.php b/src/infrastructure/daemon/workers/PhabricatorWorker.php
--- a/src/infrastructure/daemon/workers/PhabricatorWorker.php
+++ b/src/infrastructure/daemon/workers/PhabricatorWorker.php
@@ -94,16 +94,19 @@
final public static function scheduleTask(
$task_class,
$data,
- $priority = null) {
+ $options = array()) {
+ $priority = idx($options, 'priority');
if ($priority === null) {
$priority = self::PRIORITY_DEFAULT;
}
+ $object_phid = idx($options, 'objectPHID');
$task = id(new PhabricatorWorkerActiveTask())
->setTaskClass($task_class)
->setData($data)
- ->setPriority($priority);
+ ->setPriority($priority)
+ ->setObjectPHID($object_phid);
if (self::$runAllTasksInProcess) {
// Do the work in-process.
@@ -114,7 +117,8 @@
$worker->doWork();
foreach ($worker->getQueuedTasks() as $queued_task) {
list($queued_class, $queued_data, $queued_priority) = $queued_task;
- self::scheduleTask($queued_class, $queued_data, $queued_priority);
+ $queued_options = array('priority' => $queued_priority);
+ self::scheduleTask($queued_class, $queued_data, $queued_options);
}
break;
} catch (PhabricatorWorkerYieldException $ex) {
diff --git a/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php b/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
--- a/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
+++ b/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
@@ -206,7 +206,7 @@
return PhabricatorWorker::scheduleTask(
'PhabricatorTestWorker',
$data,
- $priority);
+ array('priority' => $priority));
}
}
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
@@ -9,6 +9,7 @@
const PHASE_EXPIRED = 'expired';
private $ids;
+ private $objectPHIDs;
private $limit;
private $skipLease;
@@ -39,6 +40,11 @@
return $this;
}
+ public function withObjectPHIDs(array $phids) {
+ $this->objectPHIDs = $phids;
+ return $this;
+ }
+
public function setLimit($limit) {
$this->limit = $limit;
return $this;
@@ -175,6 +181,10 @@
$where[] = qsprintf($conn_w, 'id IN (%Ld)', $this->ids);
}
+ if ($this->objectPHIDs !== null) {
+ $where[] = qsprintf($conn_w, 'objectPHID IN (%Ls)', $this->objectPHIDs);
+ }
+
return $this->formatWhereClause($where);
}
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
@@ -197,7 +197,12 @@
if ($did_succeed) {
foreach ($worker->getQueuedTasks() as $task) {
list($class, $data) = $task;
- PhabricatorWorker::scheduleTask($class, $data, $this->getPriority());
+ PhabricatorWorker::scheduleTask(
+ $class,
+ $data,
+ array(
+ 'priority' => $this->getPriority(),
+ ));
}
}
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
@@ -10,6 +10,7 @@
protected $failureCount;
protected $dataID;
protected $priority;
+ protected $objectPHID;
private $data;
private $executionException;
@@ -23,6 +24,12 @@
'failureCount' => 'uint32',
'failureTime' => 'epoch?',
'priority' => 'uint32',
+ 'objectPHID' => 'phid?',
+ ),
+ self::CONFIG_KEY_SCHEMA => array(
+ 'objectPHID' => array(
+ 'columns' => array('objectPHID'),
+ ),
),
) + parent::getConfiguration();
}
diff --git a/src/infrastructure/sms/adapter/PhabricatorSMSImplementationAdapter.php b/src/infrastructure/sms/adapter/PhabricatorSMSImplementationAdapter.php
--- a/src/infrastructure/sms/adapter/PhabricatorSMSImplementationAdapter.php
+++ b/src/infrastructure/sms/adapter/PhabricatorSMSImplementationAdapter.php
@@ -81,6 +81,8 @@
'toNumbers' => $to_numbers,
'body' => $body,
),
- PhabricatorWorker::PRIORITY_ALERTS);
+ array(
+ 'priority' => PhabricatorWorker::PRIORITY_ALERTS,
+ ));
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 24, 4:49 PM (8 h, 31 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7577584
Default Alt Text
D11044.id26522.diff (7 KB)
Attached To
Mode
D11044: Daemons - add "objectPHID" to task tables.
Attached
Detach File
Event Timeline
Log In to Comment