diff --git a/nailgun/manage.py b/nailgun/manage.py index bd6ddb060..da873dfb7 100755 --- a/nailgun/manage.py +++ b/nailgun/manage.py @@ -77,6 +77,8 @@ if __name__ == "__main__": parser.print_help() elif params.action in ("run", "runwsgi"): from rpc import threaded + import eventlet + eventlet.monkey_patch() q = threaded.rpc_queue rpc_thread = threaded.RPCThread() diff --git a/nailgun/rpc/threaded.py b/nailgun/rpc/threaded.py index c74ea927c..73f3a3b49 100644 --- a/nailgun/rpc/threaded.py +++ b/nailgun/rpc/threaded.py @@ -14,57 +14,14 @@ from api.models import engine rpc_queue = Queue.Queue() -class TestReceiver(object): - """Simple Proxy class so the consumer has methods to call. - - Uses static methods because we aren't actually storing any state. - - """ - - @staticmethod - def echo(value): - """Simply returns whatever value is sent in.""" - return value - - @staticmethod - def multicall_three_nones(value): - yield None - yield None - yield None - - @staticmethod - def echo_three_times_yield(value): - yield value - yield value + 1 - yield value + 2 - - @staticmethod - def fail(value): - """Raises an exception with the value sent in.""" - raise Exception(value) - - @staticmethod - def block(value): - time.sleep(2) - - -import eventlet -eventlet.monkey_patch() - - class RPCThread(threading.Thread): - def __init__(self, testmode=False): + def __init__(self): super(RPCThread, self).__init__() self.queue = rpc_queue self.db = scoped_session( sessionmaker(bind=engine, query_cls=Query) ) self.conn = rpc.create_connection(True) - self.testmode = testmode - if not self.testmode: - self.receiver = TestReceiver() - self.conn.create_consumer('test', self.receiver, False) - self.conn.consume_in_thread() def run(self): logging.info("Starting RPC thread...")