Page MenuHomePhabricator

D17431.id.diff
No OneTemporary

D17431.id.diff

diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
@@ -22,6 +22,12 @@
'wildcard' => true,
),
array(
+ 'name' => 'pool',
+ 'param' => 'count',
+ 'help' => pht('Maximum pool size.'),
+ 'default' => 1,
+ ),
+ array(
'name' => 'as-current-user',
'help' => pht(
'Run the daemon as the current user '.
@@ -43,6 +49,7 @@
$config = array(
'class' => array_shift($argv),
'label' => 'debug',
+ 'pool' => (int)$args->getArg('pool'),
'argv' => $argv,
);
diff --git a/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php b/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
--- a/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
+++ b/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
@@ -24,7 +24,14 @@
}
protected function doWork() {
- switch (idx($this->getTaskData(), 'doWork')) {
+ $data = $this->getTaskData();
+
+ $duration = idx($data, 'duration');
+ if ($duration) {
+ usleep($duration * 1000000);
+ }
+
+ switch (idx($data, 'doWork')) {
case 'fail-temporary':
throw new Exception(pht('Temporary failure!'));
case 'fail-permanent':
diff --git a/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementFloodWorkflow.php b/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementFloodWorkflow.php
--- a/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementFloodWorkflow.php
+++ b/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementFloodWorkflow.php
@@ -11,12 +11,24 @@
pht(
'Flood the queue with test tasks. This command is intended for '.
'use when developing and debugging Phabricator.'))
- ->setArguments(array());
+ ->setArguments(
+ array(
+ array(
+ 'name' => 'duration',
+ 'param' => 'seconds',
+ 'help' => pht(
+ 'Queue tasks which require a specific amount of wall time to '.
+ 'complete. By default, tasks complete as quickly as possible.'),
+ 'default' => 0,
+ ),
+ ));
}
public function execute(PhutilArgumentParser $args) {
$console = PhutilConsole::getConsole();
+ $duration = (float)$args->getArg('duration');
+
$console->writeOut(
"%s\n",
pht('Adding many test tasks to worker queue. Use ^C to exit.'));
@@ -25,7 +37,9 @@
while (true) {
PhabricatorWorker::scheduleTask(
'PhabricatorTestWorker',
- array());
+ array(
+ 'duration' => $duration,
+ ));
if (($n++ % 100) === 0) {
$console->writeOut('.');

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 2, 7:08 AM (6 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7687694
Default Alt Text
D17431.id.diff (3 KB)

Event Timeline