diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-02-16 23:09:08 +0000 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-02-16 23:09:08 +0000 |
| commit | 28a38e0dc00a7a7695bfec6f33a365ac2ab2106d (patch) | |
| tree | c74fc3e0bc85c859bb4052d191568313f3a07847 /nova/rpc.py | |
| parent | a5ec2be709d28267075ddc9616c5c29b62622af5 (diff) | |
| parent | ca440bdc97048e997ec64087d693c68910b6142f (diff) | |
Merging trunk
Diffstat (limited to 'nova/rpc.py')
| -rw-r--r-- | nova/rpc.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/rpc.py b/nova/rpc.py index 2b1f7298b..205bb524a 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -29,6 +29,7 @@ import uuid from carrot import connection as carrot_connection from carrot import messaging +from eventlet import greenpool from eventlet import greenthread from nova import context @@ -42,6 +43,8 @@ from nova import utils FLAGS = flags.FLAGS LOG = logging.getLogger('nova.rpc') +flags.DEFINE_integer('rpc_thread_pool_size', 1024, 'Size of RPC thread pool') + class Connection(carrot_connection.BrokerConnection): """Connection instance object""" @@ -155,11 +158,15 @@ class AdapterConsumer(TopicConsumer): def __init__(self, connection=None, topic="broadcast", proxy=None): LOG.debug(_('Initing the Adapter Consumer for %s') % topic) self.proxy = proxy + self.pool = greenpool.GreenPool(FLAGS.rpc_thread_pool_size) super(AdapterConsumer, self).__init__(connection=connection, topic=topic) + def receive(self, *args, **kwargs): + self.pool.spawn_n(self._receive, *args, **kwargs) + @exception.wrap_exception - def receive(self, message_data, message): + def _receive(self, message_data, message): """Magically looks for a method on the proxy object and calls it Message data should be a dictionary with two keys: |
