From 293b8b25ab34fe4d3d847adc6f295d02d6ee0176 Mon Sep 17 00:00:00 2001
From: Leo Gordon <lg4@ebi.ac.uk>
Date: Fri, 23 May 2014 17:03:50 +0100
Subject: [PATCH] cosmetic: reordered conditions to simplify the control flow
 logic

---
 modules/Bio/EnsEMBL/Hive/Worker.pm | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Hive/Worker.pm b/modules/Bio/EnsEMBL/Hive/Worker.pm
index 88a08e2fa..7bad22086 100644
--- a/modules/Bio/EnsEMBL/Hive/Worker.pm
+++ b/modules/Bio/EnsEMBL/Hive/Worker.pm
@@ -515,16 +515,14 @@ sub run {
             }
         }
 
-        if( $self->cause_of_death() =~ /^(NO_WORK|HIVE_OVERLOAD)$/ ) {
-            if( $self->cause_of_death() eq 'NO_WORK') {
-                $self->adaptor->db->get_AnalysisStatsAdaptor->update_status( $self->current_role->analysis_id, 'ALL_CLAIMED' );
-            }
-            
-            if( $self->can_respecialize and !$specialization_arglist ) {
-                $self->cause_of_death(undef);
-                $self->adaptor->db->get_AnalysisStatsAdaptor->decrease_running_workers( $self->current_role->analysis->dbID );  # FIXME: tidy up this counting of active roles
-                $self->specialize_and_compile_wrapper();
-            }
+        if( $self->cause_of_death() eq 'NO_WORK') {
+            $self->adaptor->db->get_AnalysisStatsAdaptor->update_status( $self->current_role->analysis_id, 'ALL_CLAIMED' );
+        }
+
+        if( $self->cause_of_death() =~ /^(NO_WORK|HIVE_OVERLOAD)$/ and $self->can_respecialize and !$specialization_arglist ) {
+            $self->adaptor->db->get_AnalysisStatsAdaptor->decrease_running_workers( $self->current_role->analysis->dbID );  # FIXME: tidy up this counting of active roles
+            $self->cause_of_death(undef);
+            $self->specialize_and_compile_wrapper();
         }
 
     }     # /Worker's lifespan loop
-- 
GitLab