From 1379a13c7686cfef66f52aa85625d609cf8b7400 Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Wed, 22 Jul 2015 08:09:19 -0400 Subject: [PATCH] wait for all locks to be free when updating schema --- includes/sql-schema/update.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/sql-schema/update.php b/includes/sql-schema/update.php index 19b043ada1..46233e8dd5 100644 --- a/includes/sql-schema/update.php +++ b/includes/sql-schema/update.php @@ -34,7 +34,11 @@ if (!isset($debug)) { if (!dbGetLock('schema_update')) { echo "Schema update already in progress. Exiting"; exit(1); -} +} //end if + +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); $insert = 0;