deferred execution thread should be named and marked as daemon

This commit is contained in:
Kevin Hester
2024-06-25 12:23:38 -07:00
parent d1aadf0c8e
commit f8ad4fef7c

View File

@@ -266,9 +266,10 @@ class Acknowledgment:
class DeferredExecution:
"""A thread that accepts closures to run, and runs them as they are received"""
def __init__(self, name=None):
def __init__(self, name):
self.queue = Queue()
self.thread = threading.Thread(target=self._run, args=(), name=name)
# this thread must be marked as daemon, otherwise it will prevent clients from exiting
self.thread = threading.Thread(target=self._run, args=(), name=name, daemon=True)
self.thread.daemon = True
self.thread.start()