From db8062fda9c4a58cb94176016e36bee8ca449f08 Mon Sep 17 00:00:00 2001 From: willtp87 Date: Mon, 7 Dec 2015 14:49:18 -0400 Subject: [PATCH] Better handling when we can not get a lock. --- includes/tuque_wrapper.inc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/tuque_wrapper.inc b/includes/tuque_wrapper.inc index 5f09985b..f075c402 100644 --- a/includes/tuque_wrapper.inc +++ b/includes/tuque_wrapper.inc @@ -493,10 +493,9 @@ class IslandoraFedoraApiM extends FedoraApiM { if (variable_get('islandora_use_object_semaphores', FALSE)) { $lock_period = variable_get('islandora_semaphore_period', 600); - if (!lock_acquire($pid, $lock_period)) { - // Waiting forever. - while (!lock_wait($pid) && lock_acquire($pid, $lock_period)) { - break; + while (!lock_acquire($pid, $lock_period)) { + // Wait for the lock to be free. In the worst case forever. + while (lock_wait($pid)) { } } $locked = TRUE;