summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-31 17:20:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-31 17:36:53 +0100
commita7591ef34ce70ff1d7aa9362d7473e6f16fbd10f (patch)
tree0f96138d632e4361837dd0425730bf07588cffbd
parenta38164620ebdc770690c5f39ff9ed69d3f82719e (diff)
downloadbitbake-contrib-a7591ef34ce70ff1d7aa9362d7473e6f16fbd10f.zip
bitbake-contrib-a7591ef34ce70ff1d7aa9362d7473e6f16fbd10f.tar.gz
bitbake-contrib-a7591ef34ce70ff1d7aa9362d7473e6f16fbd10f.tar.bz2
prserv/serv: Send sentinel to stop handler thread
Shutdown from SIGTERM currently has to wait for the handler thread to timeout. Add a sentinel value which triggers it to loop and allows for a quick exit. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/prserv/serv.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/prserv/serv.py b/lib/prserv/serv.py
index a2da072..6be78c8 100644
--- a/lib/prserv/serv.py
+++ b/lib/prserv/serv.py
@@ -84,6 +84,8 @@ class PRServer(SimpleXMLRPCServer):
except queue.Empty:
self.table.sync_if_dirty()
continue
+ if request is None:
+ continue
try:
self.finish_request(request, client_address)
self.shutdown_request(request)
@@ -103,7 +105,8 @@ class PRServer(SimpleXMLRPCServer):
def sigterm_handler(self, signum, stack):
if self.table:
self.table.sync()
- self.quit=True
+ self.quit()
+ self.requestqueue.put((None, None))
def process_request(self, request, client_address):
self.requestqueue.put((request, client_address))