8000 Make background threads daemonic by danielhollas · Pull Request #550 · aiidalab/aiidalab · GitHub
[go: up one dir, main page]

Skip to content

Make background threads daemonic - #550

Merged
danielhollas merged 1 commit into
mainfrom
daemon-threads
Oct 12, 2026
Merged

danielhollas merged 1 commit into
mainfrom
daemon-threads

Conversation

@danielhollas
@danielhollas danielhollas commented Oct 12, 2026 •
Copy link
Copy Markdown
Contributor

Closes #538. I believe this is the last repo we had non-daemonic background threads, we've fixed AWB and aiidalab-home already (not sure about QeApp).

Review from Claude Opus 5.5

The code review found no issues in this branch.

  • Watcher thread (app.py:808): this thread only polls the directory and starts or stops the file observer, and watchdog's observer threads are already daemonic. Making the watcher daemonic too means the process no longer hangs on exit when stop() is never called. Calling stop() and joining the thread work as before.
  • refresh_async (app.py:1109): nothing joins this thread, and refresh() only reads app state, so killing it at exit loses nothing.
  • One thing to keep in mind, not a bug: refresh() can reach the registry through the requests_cache SQLite backend. If the process exits mid-request, a cache write could be cut off, but SQLite rolls back unfinished writes, so the cache won't be corrupted.

@codecov
codecov Bot commented Oct 12, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.27%. Comparing base (acbd7b7) to head (688e17c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #550   +/-   ##
=======================================
  Coverage   76.27%   76.27%           
=======================================
  Files          18       18           
  Lines        1779     1779           
=======================================
  Hits         1357     1357           
  Misses        422      422           
Flag Coverage Δ
py-3.12 76.27% <100.00%> (ø)
py-3.14 76.17% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edan-bainglass edan-bainglass left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. Note that at least in my dev container where other repos are patched, memory has been much more manageable 😇

@danielhollas
danielhollas merged commit d878d65 into main Oct 12, 2026
9 checks passed
@danielhollas
danielhollas deleted the daemon-threads branch October 12, 2026 14:50
@danielhollas danielhollas added the enhancement New feature or request label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Threads potentially preventing kernel shutdown

2 participants

0