Browse Source

Remove unecessary finally clauses

These clauses are attached to exception handlers which always
proceed, and are therefore unecessary and can be a little confusing
when reading the code.

Change-Id: Ic01d48bf4a0d935a4f32bc28aae13551b4b66e7f
tags/3.4.0
James E. Blair 5 months ago
parent
commit
3ddce68728
2 changed files with 5 additions and 7 deletions
  1. 3
    4
      zuul/manager/__init__.py
  2. 2
    3
      zuul/scheduler.py

+ 3
- 4
zuul/manager/__init__.py View File

@@ -437,10 +437,9 @@ class PipelineManager(object):
437 437
             except Exception:
438 438
                 self.log.exception("Exception while canceling build %s "
439 439
                                    "for change %s" % (build, item.change))
440
-            finally:
441
-                tenant = old_build_set.item.pipeline.tenant
442
-                tenant.semaphore_handler.release(
443
-                    old_build_set.item, build.job)
440
+            tenant = old_build_set.item.pipeline.tenant
441
+            tenant.semaphore_handler.release(
442
+                old_build_set.item, build.job)
444 443
 
445 444
             if not was_running:
446 445
                 nodeset = build.build_set.getJobNodeSet(build.job.name)

+ 2
- 3
zuul/scheduler.py View File

@@ -837,9 +837,8 @@ class Scheduler(threading.Thread):
837 837
                     self.log.exception(
838 838
                         "Exception while removing nodeset from build %s "
839 839
                         "for change %s" % (build, build.build_set.item.change))
840
-                finally:
841
-                    tenant.semaphore_handler.release(
842
-                        build.build_set.item, build.job)
840
+                tenant.semaphore_handler.release(
841
+                    build.build_set.item, build.job)
843 842
 
844 843
     def _reconfigureTenant(self, tenant):
845 844
         # This is called from _doReconfigureEvent while holding the

Loading…
Cancel
Save