diff options
author | Soren Hansen <soren.hansen@rackspace.com> | 2010-10-05 15:20:23 +0200 |
---|---|---|
committer | Soren Hansen <soren.hansen@rackspace.com> | 2010-10-05 15:20:23 +0200 |
commit | 4b9be67025c3aff4b7f5f9b31a74eb14924885cb (patch) | |
tree | 562288f853fa374d4a3a2af985307ac18f691088 /nova/rpc.py | |
parent | 1158e1817b7d39e9655b219ede865f301153e713 (diff) | |
download | nova-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.py | 8 |
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) |