From f87a456def638626362a7a355a95297d7090c6eb Mon Sep 17 00:00:00 2001 From: Leo Gordon <lg4@ebi.ac.uk> Date: Wed, 1 Oct 2014 09:35:49 +0100 Subject: [PATCH] since safe_sync may or may not work, return the success indicator --- modules/Bio/EnsEMBL/Hive/Queen.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/Bio/EnsEMBL/Hive/Queen.pm b/modules/Bio/EnsEMBL/Hive/Queen.pm index 66bed6426..f9a216a75 100644 --- a/modules/Bio/EnsEMBL/Hive/Queen.pm +++ b/modules/Bio/EnsEMBL/Hive/Queen.pm @@ -529,7 +529,9 @@ sub synchronize_hive { Description: Prewrapper around synchronize_AnalysisStats that does checks and grabs sync_lock before proceeding with sync. Used by distributed worker sync system to avoid contention. - Exceptions : none + Returns 1 on success and 0 if the lock could not have been obtained, + and so no sync was attempted. + Returntype : boolean Caller : general =cut @@ -554,8 +556,11 @@ sub safe_synchronize_AnalysisStats { if( $row_count == 1 ) { # if we managed to obtain the lock, let's go and perform the sync: $self->synchronize_AnalysisStats($stats); + return 1; } # otherwise assume it's locked and just return un-updated } + + return 0; } -- GitLab