Skip to content

Commit 7d18615

Browse files
committed
reconfiguring the timeouts
1 parent 67c193d commit 7d18615

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/PatternLab/Console/Commands/ServerCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public function run() {
5858
// set-up the base command
5959
$command = $this->pathPHP." -S ".$host." ".$coreDir."/server/router.php";
6060
$commands = array();
61-
$commands[] = array("command" => $command, "cwd" => $publicDir, "timeout" => null, "idle" => 600);
61+
$commands[] = array("command" => $command, "cwd" => $publicDir, "timeout" => null, "idle" => 1800);
6262

6363
// get the watch command info
6464
if (Console::findCommandOption("with-watch")) {
6565
$watchCommand = new WatchCommand;
66-
$commands[] = array("command" => $watchCommand->build()." --no-procs", "timeout" => null, "idle" => 600);
66+
$commands[] = array("command" => $watchCommand->build()." --no-procs", "timeout" => null, "idle" => 1800);
6767
}
6868

6969
Console::writeInfo("server started on http://".$host." - use ctrl+c to exit...");

src/PatternLab/Console/ProcessSpawner.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
use \PatternLab\Console\ProcessSpawnerEvent;
2020
use \PatternLab\Dispatcher;
2121
use \PatternLab\Timer;
22+
use \Symfony\Component\Process\Exception\ProcessTimedOutException;
2223
use \Symfony\Component\Process\Process;
2324

25+
2426
class ProcessSpawner {
2527

2628
protected $pluginProcesses;
@@ -63,13 +65,9 @@ public function spawn($commands = array(), $quiet = false) {
6365
// if there are processes to spawn do so
6466
if (!empty($processes)) {
6567

66-
// get the time out
67-
$timeout = Config::getOption("timeout") ? (int)Config::getOption("timeout") : 3600;
68-
6968
// start the processes
7069
foreach ($processes as $process) {
7170
$process["process"]->start();
72-
$process["process"]->setTimeout($timeout);
7371
}
7472

7573
// check on them and produce output
@@ -83,8 +81,12 @@ public function spawn($commands = array(), $quiet = false) {
8381
print $process["process"]->getIncrementalErrorOutput();
8482
}
8583
}
86-
} catch (\RuntimeException $e) {
87-
Console::writeError("pattern lab processes automatically time out after ".$timeout." seconds...");
84+
} catch (ProcessTimedOutException $e) {
85+
if ($e->isGeneralTimeout()) {
86+
Console::writeError("pattern lab processes should never time out. yours did...");
87+
} else if ($e->isIdleTimeout()) {
88+
Console::writeError("pattern lab processes automatically time out if their is no command line output in 30 minutes...");
89+
}
8890
}
8991
}
9092
usleep(100000);
@@ -110,7 +112,7 @@ protected function buildProcess($commandOptions) {
110112
$cwd = isset($commandOptions["cwd"]) ? $commandOptions["cwd"] : null;
111113
$env = isset($commandOptions["env"]) ? $commandOptions["env"] : null;
112114
$input = isset($commandOptions["input"]) ? $commandOptions["input"] : null;
113-
$timeout = isset($commandOptions["timeout"]) ? $commandOptions["timeout"] : 60;
115+
$timeout = isset($commandOptions["timeout"]) ? $commandOptions["timeout"] : null;
114116
$options = isset($commandOptions["options"]) ? $commandOptions["options"] : array();
115117
$idle = isset($commandOptions["idle"]) ? $commandOptions["idle"] : null;
116118
$output = isset($commandOptions["output"]) ? $commandOptions["output"] : true;

0 commit comments

Comments
 (0)