catch greenlet.GreenletExit when shutting service down

This commit is contained in:
Chris Behrens
2011-05-25 15:42:24 -07:00
committed by termie
parent 25e66493fc
commit 76e639cf1f
2 changed files with 6 additions and 2 deletions

View File

@@ -24,13 +24,13 @@ No fan-out support yet.
""" """
import greenlet
import json import json
import sys import sys
import time import time
import traceback import traceback
import uuid import uuid
import greenlet
from carrot import connection as carrot_connection from carrot import connection as carrot_connection
from carrot import messaging from carrot import messaging
import eventlet import eventlet

View File

@@ -19,6 +19,7 @@
"""Generic Node baseclass for all workers that run on hosts.""" """Generic Node baseclass for all workers that run on hosts."""
import greenlet
import inspect import inspect
import os import os
@@ -166,7 +167,10 @@ class Service(object):
def kill(self): def kill(self):
"""Destroy the service object in the datastore.""" """Destroy the service object in the datastore."""
self.csetthread.kill() self.csetthread.kill()
self.csetthread.wait() try:
self.csetthread.wait()
except greenlet.GreenletExit:
pass
self.stop() self.stop()
try: try:
db.service_destroy(context.get_admin_context(), self.service_id) db.service_destroy(context.get_admin_context(), self.service_id)