summaryrefslogtreecommitdiffstats
path: root/nova/rpc.py
diff options
context:
space:
mode:
authorCerberus <matt.dietz@rackspace.com>2011-02-17 14:23:28 -0600
committerCerberus <matt.dietz@rackspace.com>2011-02-17 14:23:28 -0600
commit0c002f443de98b8d0164f7ad801f9ff5ef901101 (patch)
tree5d7cef28e337912c1145a9097ca75e38a03d3e30 /nova/rpc.py
parent3dd6e369c0aa2e3092eaa32a6b04cbba712ba5ad (diff)
parent2f48d2ab1cccfc68516e89f58cf5033032da70f5 (diff)
downloadnova-0c002f443de98b8d0164f7ad801f9ff5ef901101.tar.gz
nova-0c002f443de98b8d0164f7ad801f9ff5ef901101.tar.xz
nova-0c002f443de98b8d0164f7ad801f9ff5ef901101.zip
Merge from trunk
Diffstat (limited to 'nova/rpc.py')
-rw-r--r--nova/rpc.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/rpc.py b/nova/rpc.py
index 292fbaaf2..8ae78b7e8 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: