From a0e3715dbb00e45d75c45ed903cbffdecb2dfe5c Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Tue, 18 Aug 2015 12:09:27 +0200 Subject: [PATCH] Modify ykval-queue daemon. - don't run ykval-queue for single node configurations. --- ykval-queue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ykval-queue b/ykval-queue index 529f001..d7ab1e5 100755 --- a/ykval-queue +++ b/ykval-queue @@ -34,16 +34,20 @@ require_once 'ykval-synclib.php'; require_once 'ykval-config.php'; require_once 'ykval-log.php'; -// FIXME -// if sync pool is empty && db queue is empty: -// exit - // FIXME // don't die if db connection goes away // (e.g. during mysql restart or upgrade). $sl = new SyncLib('ykval-queue:synclib'); +if ($sl->getNumberOfServers() === 0 && $sl->getQueueLength() === 0) +{ + $sl->log(LOG_NOTICE, 'server sync pool is empty and sync queue is also empty.'); + $sl->log(LOG_NOTICE, 'configuration looks like a single node setup.'); + $sl->log(LOG_NOTICE, 'ykval-queue daemon terminating.'); + exit(0); +} + # Loop forever and resync do { $sl->reSync($baseParams['__YKVAL_SYNC_OLD_LIMIT__'],