Fix for unexpected termination of worker threads #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
When the
task(*args, **kwargs)
call was a valid function (notNone
) but had aTypeError
it would cause the thread to terminate. This had caused gateway configs timeout on gateways that had in-fact responded in time. The unexpected exit on a TypeError without any logging made it very difficult to find the fault.This change instead explicitly checks if the task is
None
prior to terminating. Otherwise, any errors that occur will be logged usinglogging.exception
but the thread itself will continue processing work. This stops any unexpected terminations of worker threads if aTypeError
occurs during processing.I've used the catch all
Exception
since I'd think most people would like things to continue processing if an error occurs on one job and cantry except exit
themselves if they would like things to stop. However, completely understand if you have a different opinion and would do away with it.Cheers,
Edwin