Skip to content

Commit f1b7d18

Browse files
committed
Daemonise scheduler threads
This fixes an issue where using check-ins blocks the customer's application from closing. Follow up to #257, which fixed this for continuous heartbeat threads -- but as continuous heartbeat threads cause the scheduler to spawn threads of its own, it didn't actually fix it at all.
1 parent ee553e7 commit f1b7d18

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
bump: patch
3+
type: fix
4+
---
5+
6+
Fix an issue where using check-ins blocks the application from shutting down.

src/appsignal/check_in/scheduler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def schedule(self, event: Event) -> None:
5555
logger.debug(f"Scheduling {describe([event])} to be transmitted")
5656

5757
if self.thread is None:
58-
self.thread = Thread(target=self._run)
58+
self.thread = Thread(target=self._run, daemon=True)
5959
self.thread.start()
6060

6161
def stop(self) -> None:
@@ -118,7 +118,7 @@ def _start_waker(self, debounce: float) -> None:
118118
self._stop_waker()
119119

120120
kill = ThreadEvent()
121-
thread = Thread(target=self._run_waker, args=(debounce, kill))
121+
thread = Thread(target=self._run_waker, daemon=True, args=(debounce, kill))
122122
thread.start()
123123
self.waker = kill
124124

0 commit comments

Comments
 (0)