Improvements to Status Handling
Added link to jobs page to fix any issues caused by non-synchronised time between webserver/worker machine leaving jobs permanently in the running state. Prevented the insertion of new status records unless the state is actually being changed. Made the HandBrake worker process write the status complete message instead of the run-jobs dispatched, in case it crashes.
This commit is contained in:
@@ -68,7 +68,7 @@ class RippingCluster_JobStatus {
|
||||
}
|
||||
|
||||
return $statuses;
|
||||
}
|
||||
}
|
||||
|
||||
protected function create() {
|
||||
$database = RippingCluster_Main::instance()->database();
|
||||
@@ -104,11 +104,22 @@ class RippingCluster_JobStatus {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function hasProgressInfo() {
|
||||
return ($this->status == self::RUNNING);
|
||||
}
|
||||
|
||||
public static function fixBrokenTimestamps() {
|
||||
$statuses = array();
|
||||
|
||||
$database = RippingCluster_Main::instance()->database();
|
||||
foreach ($database->selectList('SELECT * FROM job_status WHERE status=4 AND job_id IN (SELECT job_id FROM job_status WHERE status=3)') as $row) {
|
||||
$status = RippingCluster_JobStatus::fromDatabaseRow($row);
|
||||
$status->mtime = time();
|
||||
$status->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function id() {
|
||||
return $this->id;
|
||||
}
|
||||
@@ -129,7 +140,11 @@ class RippingCluster_JobStatus {
|
||||
return $this->ctime;
|
||||
}
|
||||
|
||||
public function mtime() {
|
||||
public function mtime($new_mtime = null) {
|
||||
if ($new_mtime !== null) {
|
||||
$this->mtime = $new_mtime;
|
||||
}
|
||||
|
||||
return $this->mtime;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user