diff options
author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-12 19:00:34 -0700 |
---|---|---|
committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-12 19:00:34 -0700 |
commit | dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84 (patch) | |
tree | 2e458dec12a89fcf5497367486f4288f87a06883 /nova/rpc.py | |
parent | 6cc81214b58972c0d0e815ad340c32862be834dc (diff) | |
parent | d0a55238fdf64a8da51ea1fe328a1a3dc3d17dc7 (diff) | |
download | nova-dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84.tar.gz nova-dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84.tar.xz nova-dbbdebbcd13b08ec2afb6d0d58144eeee6ecce84.zip |
merged trunk
Diffstat (limited to 'nova/rpc.py')
-rw-r--r-- | nova/rpc.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/rpc.py b/nova/rpc.py index fe52ad35f..447ad3b93 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,14 @@ class Consumer(messaging.Consumer): logging.exception("Failed to fetch message from queue") self.failed_connection = True + def attach_to_eventlet(self): + """Only needed for unit tests!""" + 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) |