Pause polling and discovery if there's an update-lock

This commit is contained in:
f0o
2015-09-01 14:14:50 +01:00
parent ccfdddeae6
commit e11f613bdd
3 changed files with 16 additions and 4 deletions

View File

@@ -98,10 +98,6 @@ if (!dbGetLock('schema_update')) {
register_shutdown_function('dbReleaseLock','schema_update');
do {
sleep(1);
} while (@dbFetchCell('SELECT COUNT(*) FROM `devices` WHERE NOT IS_FREE_LOCK(CONCAT("polling.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("queued.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("discovering.", device_id))') > 0);
foreach ($filelist as $file) {
list($filename,$extension) = explode('.', $file, 2);
if ($filename > $db_rev) {
@@ -171,3 +167,5 @@ if ($updating) {
echo "-- Done\n";
}
dbReleaseLock('schema_update');