From 4fc1f38b3bd5d8fe301eaaabbc0e9c2210c3060e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Br=C3=BCckner?= Date: Tue, 27 Jul 2021 00:21:27 +0200 Subject: [PATCH] Continue thread polling after an exception in the done callback --- blender/arm/handlers.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blender/arm/handlers.py b/blender/arm/handlers.py index f3d03f42..177a907c 100644 --- a/blender/arm/handlers.py +++ b/blender/arm/handlers.py @@ -116,7 +116,16 @@ def poll_threads() -> float: return 0.25 thread.join() - callback() + + try: + callback() + except Exception as e: + # If there is an exception, we can no longer return the time to + # the next call to this polling function, so to keep it running + # we re-register it and then raise the original exception. + bpy.app.timers.unregister(poll_threads) + bpy.app.timers.register(poll_threads, first_interval=0.01, persistent=True) + raise e # Quickly check if another thread has finished return 0.01