# HG changeset patch # User Paul Boddie # Date 1463062194 -7200 # Node ID 236701c67ebc3f88134b2ef9c35287f017fec4c0 # Parent 8fb731c8db48e80eff4b899de1c12cc8623b1c6c Remove any active locks if an exception is raised during retraction. diff -r 8fb731c8db48 -r 236701c67ebc imiptools/handlers/scheduling/__init__.py --- a/imiptools/handlers/scheduling/__init__.py Wed May 11 15:59:28 2016 +0200 +++ b/imiptools/handlers/scheduling/__init__.py Thu May 12 16:09:54 2016 +0200 @@ -102,15 +102,17 @@ # First, lock the resources to be used. start_scheduling(handler) - - # Obtain the actual retraction functions with arguments. + try: - functions = get_function_calls(handler.get_scheduling_functions(), retraction_functions) - apply_functions(functions, handler) + # Obtain the actual retraction functions with arguments. + + functions = get_function_calls(handler.get_scheduling_functions(), retraction_functions) + apply_functions(functions, handler) # Finally, unlock the resources. - finish_scheduling(handler) + finally: + finish_scheduling(handler) def start_scheduling(handler):