summaryrefslogtreecommitdiffstats
path: root/nova/rpc.py
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-10-05 15:20:23 +0200
committerSoren Hansen <soren.hansen@rackspace.com>2010-10-05 15:20:23 +0200
commit4b9be67025c3aff4b7f5f9b31a74eb14924885cb (patch)
tree562288f853fa374d4a3a2af985307ac18f691088 /nova/rpc.py
parent1158e1817b7d39e9655b219ede865f301153e713 (diff)
downloadnova-4b9be67025c3aff4b7f5f9b31a74eb14924885cb.tar.gz
nova-4b9be67025c3aff4b7f5f9b31a74eb14924885cb.tar.xz
nova-4b9be67025c3aff4b7f5f9b31a74eb14924885cb.zip
Add a connect_to_eventlet method.
Diffstat (limited to 'nova/rpc.py')
-rw-r--r--nova/rpc.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nova/rpc.py b/nova/rpc.py
index fe52ad35f..782c76765 100644
--- a/nova/rpc.py
+++ b/nova/rpc.py
@@ -28,6 +28,7 @@ import uuid
from carrot import connection as carrot_connection
from carrot import messaging
+from eventlet import greenthread
from twisted.internet import defer
from twisted.internet import task
@@ -107,6 +108,13 @@ class Consumer(messaging.Consumer):
logging.exception("Failed to fetch message from queue")
self.failed_connection = True
+ def attach_to_eventlet(self):
+ def fetch_repeatedly():
+ while True:
+ self.fetch(enable_callbacks=True)
+ greenthread.sleep(0.1)
+ greenthread.spawn(fetch_repeatedly)
+
def attach_to_twisted(self):
"""Attach a callback to twisted that fires 10 times a second"""
loop = task.LoopingCall(self.fetch, enable_callbacks=True)