diff options
author | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-02-17 17:39:03 -0400 |
---|---|---|
committer | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-02-17 17:39:03 -0400 |
commit | 782a5736b01f44af43f742de537bdbe4bbda6d88 (patch) | |
tree | bdd2fbb08a98b66d9140a9be71f3a8b23778345b /nova/rpc.py | |
parent | 5a988eb393c306097250a7f17ea65f0919fd9219 (diff) | |
parent | 52753aae3486f654b9fb19d6423fc26dc180644d (diff) | |
download | nova-782a5736b01f44af43f742de537bdbe4bbda6d88.tar.gz nova-782a5736b01f44af43f742de537bdbe4bbda6d88.tar.xz nova-782a5736b01f44af43f742de537bdbe4bbda6d88.zip |
changed from 003-004 migration
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: |