-
-
Notifications
You must be signed in to change notification settings - Fork 98
Should the new _serve_unservicable thread be daemon? #769
Description
❓ I'm submitting a ...
- 🐞 bug report
- 🐣 feature request
- ❓ question about the decisions made in the repository
🐞 Describe the bug. What is the current behavior?
The most recent change in 11.0.0 that added a non-daemon thread makes the library harder to use through pytest. Specifically, I have an existing project that uses pytest to create a server in a fixture, and this thread is not closing at the end of pytest. I can hack around it by disabling the new feature (cheroot.server.HTTPServer._serve_unservicable = lambda: None), but this definitely feels wrong.
❓ What is the motivation / use case for changing the behavior?
I think that if the _serve_unservicable thread was daemon it would make using this in tests easier. The side effect is that when shutting down a server it wouldn't drain the 503 responses; but prior to 11.x those didn't exist.
💡 To Reproduce
Steps to reproduce the behavior:
I assume in my tests where I start and stop a server, some request is getting queued after I ask the server to stop and this test, rather than that being ignored is stopping the process from stopping.
💡 Expected behavior
I'd like to be able to start and stop servers in pytest fixtures without worrying about exact timing from client tests.
📋 Environment
- Cheroot version: 11.0
- CherryPy version: 18.10.0
- Python version: 3.9 through 3.13
- OS: Ubuntu