BUGFIX: don't make the result appear multiple times
This commit is contained in:
parent
5ec78ff3f3
commit
ebc442f5ce
|
@ -196,6 +196,9 @@ class Job extends Repository
|
||||||
if($job['running'] > time()) {
|
if($job['running'] > time()) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$jobsSql = "UPDATE job SET running = :status WHERE id = :id";
|
||||||
|
$jobsStmt = $this->dbcon->prepare($jobsSql);
|
||||||
|
$jobsStmt->executeQuery([':id' => $job['id'], ':status' => 1]);
|
||||||
|
|
||||||
if (!empty($job['data']['vars'])) {
|
if (!empty($job['data']['vars'])) {
|
||||||
foreach ($job['data']['vars'] as $key => $var) {
|
foreach ($job['data']['vars'] as $key => $var) {
|
||||||
|
@ -208,12 +211,9 @@ class Job extends Repository
|
||||||
$return = $this->runLocalCommand($job['data']['getservices-command']);
|
$return = $this->runLocalCommand($job['data']['getservices-command']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$jobsSql = "UPDATE job SET running = :status WHERE id = :id";
|
|
||||||
$jobsStmt = $this->dbcon->prepare($jobsSql);
|
|
||||||
$jobsStmt->executeQuery([':id' => $job['id'], ':status' => 1]);
|
|
||||||
|
|
||||||
$starttime = (float)$this->getTempVar($job['id'], 'starttime');
|
$starttime = (float)$this->getTempVar($job['id'], 'starttime');
|
||||||
$return['starttime'] = $starttime;
|
$this->deleteTempVar($job['id'], 'starttime');
|
||||||
|
$return['starttime'] = $starttime;
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ class Job extends Repository
|
||||||
$result = $this->runRebootJob($job, $starttime);
|
$result = $this->runRebootJob($job, $starttime);
|
||||||
}
|
}
|
||||||
$endtime = microtime(true);
|
$endtime = microtime(true);
|
||||||
$runtime = $endtime - ($return['starttime'] ?? $starttime);
|
$runtime = $endtime - ($result['starttime'] ?? $starttime);
|
||||||
|
|
||||||
// handling of response
|
// handling of response
|
||||||
$addRunSql = 'INSERT INTO run(job_id, exitcode, output, runtime, timestamp) VALUES (:job_id, :exitcode, :output, :runtime, :timestamp)';
|
$addRunSql = 'INSERT INTO run(job_id, exitcode, output, runtime, timestamp) VALUES (:job_id, :exitcode, :output, :runtime, :timestamp)';
|
||||||
|
|
Loading…
Reference in New Issue