Skip to content

Commit

Permalink
refs #31: Disable process timeout for validation (workers have fallba…
Browse files Browse the repository at this point in the history
…ck timeouts)
  • Loading branch information
eFrane committed Nov 25, 2017
1 parent 1cb856c commit 5b791c5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Spec/Jobs/ValidatorRunJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ protected function runValidator(Log $log, Filesystem $fs)
$fs->makeDirectory('validation');
}

$validationResultFile = storage_path('app/validation/'.uniqid('validation-').'.result');
$validationResultFile = storage_path('app/validation/' . uniqid('validation-') . '.result');
$validatorCmd = sprintf('./validate --porcelain -fjson -o%s "%s"', $validationResultFile, $this->endpoint);

$validator = new Process($validatorCmd);
$validator->setTimeout(0);
$validator->setIdleTimeout(0);
$validator->setEnv([
'PATH' => "{$validatorRepo->getAbsolutePath()}:/usr/local/bin:/usr/bin",
]);
Expand All @@ -110,14 +112,14 @@ protected function runValidator(Log $log, Filesystem $fs)

$validator->run(function ($type, $data) use ($log, $validatorLogPrefix) {
// $type will always be Process::ERR for validator data since it writes it's progress output to STDERR
$log->debug($validatorLogPrefix.$data);
$log->debug($validatorLogPrefix . $data);
});

if ($validator->getExitCode() !== 0) {
throw ValidationFailed::validatorQuitUnexpectedly();
}

$result = (array) json_decode(file_get_contents($validationResultFile), true);
$result = (array)json_decode(file_get_contents($validationResultFile), true);

if (file_exists($validationResultFile)) {
unlink($validationResultFile);
Expand Down

0 comments on commit 5b791c5

Please sign in to comment.