Closed mwarning closed 5 years ago
I agree -- seems like there should be channel returned by start_server
. Sending something down the transmitter end of the channel should cause the Server
to stop gracefully (or ungracefully).
For my own tests, I've taken to simple spawning a new thread to hold the Server
created by start_server
. When my test function ends, the spawned thread will be shutdown...I'm not :100: sure this solution will work when I have more than exactly 1 test case.
Digging through issues found this: https://github.com/tomaka/rouille/issues/139#issuecomment-297480690
Basically, just call server.poll()
until you want to stop the server.
yes, but only until there is an incoming request.. Maybe you can do a dummy connection..
ok, I will create a dummy connection to trigger the exit. Not the nicest solution. But it will probably work.
There should be a way to end rouille. The passed closure just does blocking IO and there seems to be no way to end the thread from another thread..