Skip to content

Commit da9b8a8

Browse files
committed
Poller threads block main thread from exiting bug #134
* Set poller threads as daemon threads so they dont block the main thread on exit.
1 parent e4827a4 commit da9b8a8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

aws_xray_sdk/core/sampling/rule_poller.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ def __init__(self, cache, connector):
1919
self._connector = connector
2020

2121
def start(self):
22-
threading.Thread(target=self._worker).start()
22+
poller_thread = threading.Thread(target=self._worker)
23+
poller_thread.daemon = True
24+
poller_thread.start()
2325

2426
def _worker(self):
2527
frequency = 1

aws_xray_sdk/core/sampling/target_poller.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def __init__(self, cache, rule_poller, connector):
2020
self._interval = 10 # default 10 seconds interval on sampling targets fetch
2121

2222
def start(self):
23-
threading.Thread(target=self._worker).start()
23+
poller_thread = threading.Thread(target=self._worker)
24+
poller_thread.daemon = True
25+
poller_thread.start()
2426

2527
def _worker(self):
2628
while True:

0 commit comments

Comments
 (0)