Hopefully fixes #98 and all job tasks bugs

This commit is contained in:
Renzo 2016-07-30 00:16:24 -05:00
parent 536a1f907b
commit 61b48d0ca1

View File

@ -113,8 +113,15 @@ class JobTask extends Rails\ActiveRecord\Base
if ($count == 0) if ($count == 0)
$this->updateAttribute('status', "finished"); $this->updateAttribute('status', "finished");
else else {
// This is necessary due to a bug with Rails that won't clear changed attributes,
// so when 'status' is changed back to 'pending', the system will think the attribute
// is being reversed to its previous value, and will remove it from the changedAttributes,
// array, therefore the new value 'pending' won't be set and will stay as 'processing'.
$this->clearChangedAttributes();
$this->updateAttributes(array('status' => "pending", 'repeat_count' => $count)); $this->updateAttributes(array('status' => "pending", 'repeat_count' => $count));
}
} catch (Exception $x) { } catch (Exception $x) {
$text = ""; $text = "";
$text .= "Error executing job: " . $this->task_type . "\n"; $text .= "Error executing job: " . $this->task_type . "\n";