@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 "--pool" and "--duration" flags to daemon CLI tools

Summary: Ref T12331. These changes are intended to make it easier to debug T12331 since I'm having difficulty reproducing the issue locally.

Test Plan:
- Ran `bin/phd debug task --pool 4` and got an autoscaling pool.
- Ran `bin/worker flood --duration 3` and got some 3-second-long tasks to execute with `bin/worker execute ...`.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12331

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

+31 -3
+7
src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
··· 22 22 'wildcard' => true, 23 23 ), 24 24 array( 25 + 'name' => 'pool', 26 + 'param' => 'count', 27 + 'help' => pht('Maximum pool size.'), 28 + 'default' => 1, 29 + ), 30 + array( 25 31 'name' => 'as-current-user', 26 32 'help' => pht( 27 33 'Run the daemon as the current user '. ··· 43 49 $config = array( 44 50 'class' => array_shift($argv), 45 51 'label' => 'debug', 52 + 'pool' => (int)$args->getArg('pool'), 46 53 'argv' => $argv, 47 54 ); 48 55
+8 -1
src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
··· 24 24 } 25 25 26 26 protected function doWork() { 27 - switch (idx($this->getTaskData(), 'doWork')) { 27 + $data = $this->getTaskData(); 28 + 29 + $duration = idx($data, 'duration'); 30 + if ($duration) { 31 + usleep($duration * 1000000); 32 + } 33 + 34 + switch (idx($data, 'doWork')) { 28 35 case 'fail-temporary': 29 36 throw new Exception(pht('Temporary failure!')); 30 37 case 'fail-permanent':
+16 -2
src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementFloodWorkflow.php
··· 11 11 pht( 12 12 'Flood the queue with test tasks. This command is intended for '. 13 13 'use when developing and debugging Phabricator.')) 14 - ->setArguments(array()); 14 + ->setArguments( 15 + array( 16 + array( 17 + 'name' => 'duration', 18 + 'param' => 'seconds', 19 + 'help' => pht( 20 + 'Queue tasks which require a specific amount of wall time to '. 21 + 'complete. By default, tasks complete as quickly as possible.'), 22 + 'default' => 0, 23 + ), 24 + )); 15 25 } 16 26 17 27 public function execute(PhutilArgumentParser $args) { 18 28 $console = PhutilConsole::getConsole(); 29 + 30 + $duration = (float)$args->getArg('duration'); 19 31 20 32 $console->writeOut( 21 33 "%s\n", ··· 25 37 while (true) { 26 38 PhabricatorWorker::scheduleTask( 27 39 'PhabricatorTestWorker', 28 - array()); 40 + array( 41 + 'duration' => $duration, 42 + )); 29 43 30 44 if (($n++ % 100) === 0) { 31 45 $console->writeOut('.');