summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-06 21:30:44 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-06 21:30:44 -0400
commit9d6006fed8317ffd3b08eaf5e10236e0f0039763 (patch)
tree0e1eed39dc6350e324410a6531489f4793d20040 /backend
parentStored all data from Packages files in the db to allow frontend/backend separ... (diff)
downloadingenue-9d6006fed8317ffd3b08eaf5e10236e0f0039763.tar.gz
ingenue-9d6006fed8317ffd3b08eaf5e10236e0f0039763.tar.bz2
ingenue-9d6006fed8317ffd3b08eaf5e10236e0f0039763.zip
Last changes for multiple backends to be (theoretically) possible
Diffstat (limited to 'backend')
-rwxr-xr-xbackend/backend.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/backend/backend.php b/backend/backend.php
index 2ee7357..78852e4 100755
--- a/backend/backend.php
+++ b/backend/backend.php
@@ -49,15 +49,22 @@ declare(ticks=1);
require_once(SHARED.'/include/dbinit.php');
while (true) {
// TODO check first for builds that need to be resumed (and figure out how to resume things)
+ $S['pdo']->query('LOCK TABLES `builds` WRITE');
$r=$S['pdo']->query('SELECT * FROM `builds` WHERE `status`="build/ready" ORDER BY `ctime` ASC LIMIT 1');
if ($r->rowCount()) {
$build=new sql_build($r->fetch(PDO::FETCH_ASSOC));
$build->start=time();
$build->status='build/running';
$build->write();
+ $S['pdo']->query('UNLOCK TABLES');
log_msg('Starting build id='.$build->id);
$file=null;
try {
+ if ($conf['split_setup']) {
+ $opt=new sql_buildopt($build->id, 'backend', $conf['backend_id']);
+ $opt->write();
+ unset($opt);
+ }
$opts=$build->get_buildopts();
$module=$opts['backend_module'];
$build_proc=$module.'_build';
@@ -116,6 +123,8 @@ while (true) {
}
$build->write();
unset($build);
+ } else {
+ $S['pdo']->query('UNLOCK TABLES');
}
// log_msg('Sleeping...', false);
sleep(5);