Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ProcessMaker/Jobs/RunScriptTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public function action(ProcessRequestToken $token = null, ScriptTaskInterface $e
if ($configuration === null) {
$configuration = [];
}

$errorHandling = null;
try {
if (empty($scriptRef)) {
$code = $element->getScript();
Expand Down Expand Up @@ -109,7 +111,10 @@ public function action(ProcessRequestToken $token = null, ScriptTaskInterface $e
} catch (Throwable $exception) {
$token->setStatus(ScriptTaskInterface::TOKEN_STATE_FAILING);

$message = $errorHandling->handleRetries($this, $exception);
$message = $exception->getMessage();
if ($errorHandling) {
$message = $errorHandling->handleRetries($this, $exception);
}

$error = $element->getRepository()->createError();
$error->setName($message);
Expand Down
8 changes: 6 additions & 2 deletions ProcessMaker/Models/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Script extends ProcessMakerModel implements ScriptInterface
protected $casts = [
'timeout' => 'integer',
'retry_attempts' => 'integer',
'retry_wait_time' => 'integer'
'retry_wait_time' => 'integer',
];

/**
Expand Down Expand Up @@ -127,8 +127,12 @@ public static function rules($existing = null)
* @param array $data
* @param array $config
*/
public function runScript(array $data, array $config, $tokenId = '', $timeout = 60)
public function runScript(array $data, array $config, $tokenId = '', $timeout = null)
{
if (!$timeout) {
$timeout = $this->timeout;
}

if (!$this->scriptExecutor) {
throw new ScriptLanguageNotSupported($this->language);
}
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Models/ScriptVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ public function parent()
* @param array $data
* @param array $config
*/
public function runScript(array $data, array $config, $tokenId = '')
public function runScript(array $data, array $config, $tokenId = '', $timeout = null)
{
$script = $this->parent->replicate();
$except = $script->getGuarded();
foreach (collect($script->getAttributes())->except($except)->keys() as $prop) {
$script->$prop = $this->$prop;
}

return $script->runScript($data, $config, $tokenId);
return $script->runScript($data, $config, $tokenId, $timeout);
}

/**
Expand Down